Produced by Araxis Merge on 4/26/2019 10:01:16 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | C:\AraxisMergeCompare\Pri_un\CCCC\CCCC\seoc-ui1.8\cc_seoc_ui\src\components\user-management | UserTableRow.spec.js | Tue Apr 9 17:46:26 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\CCCC\CCCC\seoc-ui1.8\cc_seoc_ui\src\components\user-management | UserTableRow.spec.js | Wed Apr 24 20:07:15 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 498 |
Changed | 1 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | import Rea ct from 'r eact'; | |
2 | import { s hallow } f rom 'enzym e'; | |
3 | ||
4 | import Use rTableRow from './Us erTableRow '; | |
5 | ||
6 | describe(' UserTableR ow Compone nt', () => { | |
7 | const us er = { | |
8 | id: ' AI ', | |
9 | userName: '
|
|
10 | role: 'Author', | |
11 | vaNetw orkId: 'SE OCAuthor', | |
12 | domain : 'DEV' | |
13 | }; | |
14 | ||
15 | let sele cted = fal se; | |
16 | const ro wIndex = 0 ; | |
17 | let upda teSelected ; | |
18 | let show Edit; | |
19 | ||
20 | let wrap per; | |
21 | let inst ance; | |
22 | ||
23 | const sh allowWrapp er = () => { | |
24 | wrappe r = shallo w( | |
25 | <Use rTableRow | |
26 | us er={user} | |
27 | se lected={se lected} | |
28 | ro wIndex={ro wIndex} | |
29 | up dateSelect ed={update Selected} | |
30 | sh owEdit={sh owEdit} /> ); | |
31 | instan ce = wrapp er.instanc e(); | |
32 | }; | |
33 | ||
34 | beforeEa ch(() => { | |
35 | showEd it = false ; | |
36 | update Selected = jest.fn() ; | |
37 | ||
38 | shallo wWrapper() ; | |
39 | }); | |
40 | ||
41 | it('shou ld use the attribute s of the s eoc prop', () => { | |
42 | shallo wWrapper() ; | |
43 | ||
44 | const rowCells = wrapper.f ind('td'); | |
45 | ||
46 | expect (rowCells. length).to Equal(4); | |
47 | expect (rowCells. at(0).text ()).toCont ain(user.u serName); | |
48 | expect (rowCells. at(1).text ()).toCont ain(user.r ole); | |
49 | expect (rowCells. at(2).text ()).toCont ain(user.v aNetworkId ); | |
50 | expect (rowCells. at(3).text ()).toCont ain(user.d omain); | |
51 | }); | |
52 | ||
53 | it('shou ld set the className to highli ght if the selected prop is tr ue', () => { | |
54 | select ed = true; | |
55 | ||
56 | shallo wWrapper() ; | |
57 | ||
58 | const actual = w rapper.pro p('classNa me'); | |
59 | const expected = 'highligh t'; | |
60 | ||
61 | expect (actual).t oEqual(exp ected); | |
62 | }); | |
63 | ||
64 | it('shou ld not set the class Name to hi ghlight if the selec ted prop i s false', () => { | |
65 | select ed = false ; | |
66 | ||
67 | shallo wWrapper() ; | |
68 | ||
69 | const actual = w rapper.pro p('classNa me'); | |
70 | const expected = ''; | |
71 | ||
72 | expect (actual).t oEqual(exp ected); | |
73 | }); | |
74 | ||
75 | it('shou ld call th e updateSe lected pro p when the row is cl icked', () => { | |
76 | instan ce.row = { focus: je st.fn() }; | |
77 | ||
78 | wrappe r.simulate ('click'); | |
79 | ||
80 | expect (updateSel ected).toB eCalled(); | |
81 | expect (updateSel ected.mock .calls[0][ 0]).toEqua l(0); | |
82 | ||
83 | update Selected.m ock.calls[ 0][1](); | |
84 | ||
85 | expect (instance. row.focus) .toBeCalle d(); | |
86 | }); | |
87 | ||
88 | it('shou ld not cal l the upda teSelected prop when the row i s clicked if showEdi t is true' , () => { | |
89 | showEd it = true; | |
90 | ||
91 | shallo wWrapper() ; | |
92 | ||
93 | wrappe r.simulate ('click'); | |
94 | ||
95 | expect (updateSel ected).not .toBeCalle d(); | |
96 | }); | |
97 | ||
98 | describe ('onKeyDow n', () => { | |
99 | let pr eventDefau lt; | |
100 | ||
101 | before Each(() => { | |
102 | prev entDefault = jest.fn (); | |
103 | ||
104 | inst ance.onCli ck = jest. fn(); | |
105 | }); | |
106 | ||
107 | it('sh ould preve nt the def ault actio n and call the click handler w hen enter is pressed ', () => { | |
108 | wrap per.simula te('keydow n', { | |
109 | wh ich: 13, | |
110 | pr eventDefau lt | |
111 | }); | |
112 | ||
113 | expe ct(instanc e.onClick) .toBeCalle d(); | |
114 | expe ct(prevent Default).t oBeCalled( ); | |
115 | }); | |
116 | ||
117 | it('sh ould not p revent the default a ction or c all the cl ick handle r when any other key is presse d', () => { | |
118 | wrap per.simula te('keydow n', { | |
119 | wh ich: 32, | |
120 | pr eventDefau lt | |
121 | }); | |
122 | ||
123 | expe ct(instanc e.onClick) .not.toBeC alled(); | |
124 | expe ct(prevent Default).n ot.toBeCal led(); | |
125 | }); | |
126 | }); | |
127 | ||
128 | describe ('tabIndex ', () => { | |
129 | it('sh ould set t he correct tabIndex when showE dit is fal se', () => { | |
130 | show Edit = fal se; | |
131 | shal lowWrapper (); | |
132 | ||
133 | cons t actual = wrapper.p rop('tabIn dex'); | |
134 | cons t expected = '0'; | |
135 | ||
136 | expe ct(actual) .toEqual(e xpected); | |
137 | }); | |
138 | ||
139 | it('sh ould set t he correct tabIndex when showE dit is tru e', () => { | |
140 | show Edit = tru e; | |
141 | shal lowWrapper (); | |
142 | ||
143 | cons t actual = wrapper.p rop('tabIn dex'); | |
144 | cons t expected = ''; | |
145 | ||
146 | expe ct(actual) .toEqual(e xpected); | |
147 | }); | |
148 | }); | |
149 | ||
150 | describe ('aria-lab el', () => { | |
151 | it('sh ould set t he correct aria-labe l when sel ected is f alse', () => { | |
152 | sele cted = fal se; | |
153 | shal lowWrapper (); | |
154 | ||
155 | cons t actual = wrapper.p rop('aria- label'); | |
156 | cons t expected = ` | |
157 | Us er Name: $ {user.user Name}, | |
158 | Ro le: ${user .role}, | |
159 | VA Network I D: ${user. vaNetworkI d}, | |
160 | Do main: ${us er.domain} | |
161 | Pr ess ENTER to Select` ; | |
162 | ||
163 | expe ct(actual) .toEqual(e xpected); | |
164 | }); | |
165 | ||
166 | it('sh ould set t he correct aria-labe l when sel ected is t rue', () = > { | |
167 | sele cted = tru e; | |
168 | shal lowWrapper (); | |
169 | ||
170 | cons t actual = wrapper.p rop('aria- label'); | |
171 | cons t expected = `Select ed | |
172 | Us er Name: $ {user.user Name}, | |
173 | Ro le: ${user .role}, | |
174 | VA Network I D: ${user. vaNetworkI d}, | |
175 | Do main: ${us er.domain} | |
176 | `; | |
177 | ||
178 | expe ct(actual) .toEqual(e xpected); | |
179 | }); | |
180 | }); | |
181 | ||
182 | describe ('aria-sel ected', () => { | |
183 | it('sh ould set a ria-select ed to true when sele cted is tr ue', () => { | |
184 | sele cted = tru e; | |
185 | shal lowWrapper (); | |
186 | ||
187 | cons t actual = wrapper.p rop('aria- selected') ; | |
188 | cons t expected = selecte d; | |
189 | ||
190 | expe ct(actual) .toEqual(e xpected); | |
191 | }); | |
192 | ||
193 | it('sh ould set a ria-select ed to fals e when sel ected is f alse', () => { | |
194 | sele cted = fal se; | |
195 | shal lowWrapper (); | |
196 | ||
197 | cons t actual = wrapper.p rop('aria- selected') ; | |
198 | cons t expected = selecte d; | |
199 | ||
200 | expe ct(actual) .toEqual(e xpected); | |
201 | }); | |
202 | }); | |
203 | ||
204 | describe ('selected text', () => { | |
205 | it('sh ould show the select ed text in the first cell when selected is true', () => { | |
206 | sele cted = tru e; | |
207 | shal lowWrapper (); | |
208 | ||
209 | cons t actual = wrapper.f ind('td'). at(0).find ('span.usa -sr-only') .text(); | |
210 | cons t expected = 'Select ed'; | |
211 | ||
212 | expe ct(actual) .toEqual(e xpected); | |
213 | }); | |
214 | ||
215 | it('sh ould not s how the se lected tex t when sel ected is f alse', () => { | |
216 | sele cted = fal se; | |
217 | shal lowWrapper (); | |
218 | ||
219 | cons t actual = wrapper.f ind('td'). at(0).find ('span.usa -sr-only') .length; | |
220 | cons t expected = 0; | |
221 | ||
222 | expe ct(actual) .toEqual(e xpected); | |
223 | }); | |
224 | }); | |
225 | ||
226 | describe ('instruct ion text', () => { | |
227 | it('sh ould show the instru ction text in the la st cell wh en selecte d is false ', () => { | |
228 | sele cted = fal se; | |
229 | shal lowWrapper (); | |
230 | ||
231 | cons t cells = wrapper.fi nd('td'); | |
232 | ||
233 | cons t actual = cells.at( cells.leng th - 1).fi nd('span.u sa-sr-only ').text(); | |
234 | cons t expected = 'Press ENTER to S elect'; | |
235 | ||
236 | expe ct(actual) .toEqual(e xpected); | |
237 | }); | |
238 | ||
239 | it('sh ould not s how the se lected tex t when sel ected is f alse', () => { | |
240 | sele cted = tru e; | |
241 | shal lowWrapper (); | |
242 | ||
243 | cons t cells = wrapper.fi nd('td'); | |
244 | ||
245 | cons t actual = cells.at( cells.leng th - 1).fi nd('span.u sa-sr-only ').length; | |
246 | cons t expected = 0; | |
247 | ||
248 | expe ct(actual) .toEqual(e xpected); | |
249 | }); | |
250 | }); | |
251 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.