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 | UserTableFormRow.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 | UserTableFormRow.spec.js | Wed Apr 24 20:06:55 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 4 | 326 |
Changed | 3 | 8 |
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 { m ount } fro m 'enzyme' ; | |
3 | ||
4 | import { r oleFilterT ypes } fro m '../../c onstants/f ilterTypes '; | |
5 | import { e xtendClone } from '. ./../utils /objectUti ls'; | |
6 | ||
7 | import { U SER_NAME_M AX_LENGTH, VA_NETWOR K_ID_MAX_L ENGTH, DOM AIN_MAX_LE NGTH } fro m './const ants/userF ormConstan ts'; | |
8 | ||
9 | import Use rTableForm Row from ' ./UserTabl eFormRow'; | |
10 | ||
11 | describe(' UserTableF ormRow Com ponent', ( ) => { | |
12 | const us er = { | |
13 | userName: ' AI ', | |
14 | role: 'ADMINISTR ATOR', | |
15 | vaNetworkI d: 'A
|
|
16 | domain: '
|
|
17 | }; | |
18 | let upda teUser; | |
19 | ||
20 | let wrap per; | |
21 | ||
22 | const mo untWrapper = () => { | |
23 | wrappe r = mount( | |
24 | <tab le> | |
25 | <t body> | |
26 | <UserTable FormRow us er={user} updateUser ={updateUs er} /> | |
27 | </ tbody> | |
28 | </ta ble>).find ('UserTabl eFormRow') ; | |
29 | }; | |
30 | ||
31 | beforeEa ch(() => { | |
32 | update User = jes t.fn(); | |
33 | ||
34 | mountW rapper(); | |
35 | }); | |
36 | ||
37 | describe ('User Nam e field', () => { | |
38 | let us erNameFiel d; | |
39 | ||
40 | before Each(() => { | |
41 | user NameField = wrapper. find('Char acterCount Input').at (0); | |
42 | }); | |
43 | ||
44 | it('sh ould use a Character CountInput component with the correct pr ops', () = > { | |
45 | expe ct(userNam eField.pro p('inputId ')).toEqua l('user-na me'); | |
46 | expe ct(userNam eField.pro p('name')) .toEqual(' userName') ; | |
47 | expe ct(userNam eField.pro p('label') ).toEqual( 'User Name '); | |
48 | expe ct(userNam eField.pro p('labelCl assName')) .toEqual(' usa-sr-onl y'); | |
49 | expe ct(userNam eField.pro p('infoTex t')).toEqu al('requir ed'); | |
50 | expe ct(userNam eField.pro p('maxLeng th')).toEq ual(USER_N AME_MAX_LE NGTH); | |
51 | expe ct(userNam eField.pro p('value') ).toEqual( user.userN ame); | |
52 | }); | |
53 | ||
54 | it('sh ould use t he userNam e from the user prop as the de fault valu e', () => { | |
55 | cons t actual = userNameF ield.prop( 'value'); | |
56 | cons t expected = user.us erName; | |
57 | ||
58 | expe ct(actual) .toEqual(e xpected); | |
59 | }); | |
60 | ||
61 | it('sh ould updat e the user Name value on change ', () => { | |
62 | user NameField. prop('onCh ange')({ | |
63 | ta rget: { | |
64 | name: user NameField. prop('name '), | |
65 | value: 'SE OC Viewer' | |
66 | } | |
67 | }); | |
68 | ||
69 | expect(upd ateUser).t oBeCalledW ith(extend Clone(user , { userNa me: ' AI ' })); | |
70 | }); | |
71 | }); | |
72 | ||
73 | describe ('Role fie ld', () => { | |
74 | let ro leField; | |
75 | ||
76 | before Each(() => { | |
77 | role Field = wr apper.find ('#user-ro le'); | |
78 | }); | |
79 | ||
80 | it('sh ould use t he role fr om the use r prop as the defaul t value', () => { | |
81 | cons t actual = roleField .prop('val ue'); | |
82 | cons t expected = user.ro le; | |
83 | ||
84 | expe ct(actual) .toEqual(e xpected); | |
85 | }); | |
86 | ||
87 | it('sh ould have an option for each o f the role FilterType s', () => { | |
88 | cons t roleOpti ons = role Field.find ('option') ; | |
89 | ||
90 | role FilterType s.forEach( (roleType, index) => { | |
91 | co nst roleOp tion = rol eOptions.a t(index); | |
92 | ||
93 | ex pect(roleO ption.key( )).toEqual (roleType) ; | |
94 | ex pect(roleO ption.prop ('value')) .toEqual(r oleType); | |
95 | ex pect(roleO ption.text ()).toEqua l(roleType ); | |
96 | }); | |
97 | }); | |
98 | ||
99 | it('sh ould updat e the role value on change', ( ) => { | |
100 | role Field.simu late('chan ge', { | |
101 | ta rget: { | |
102 | name: role Field.prop ('name'), | |
103 | value: 'VI EWER' | |
104 | } | |
105 | }); | |
106 | ||
107 | expe ct(updateU ser).toBeC alledWith( extendClon e(user, { role: 'VIE WER' })); | |
108 | }); | |
109 | }); | |
110 | ||
111 | describe ('VA Netwo rk ID fiel d', () => { | |
112 | let va NetworkIdF ield; | |
113 | ||
114 | before Each(() => { | |
115 | vaNe tworkIdFie ld = wrapp er.find('C haracterCo untInput') .at(1); | |
116 | }); | |
117 | ||
118 | it('sh ould use a Character CountInput component with the correct pr ops', () = > { | |
119 | expe ct(vaNetwo rkIdField. prop('inpu tId')).toE qual('netw ork-id'); | |
120 | expe ct(vaNetwo rkIdField. prop('name ')).toEqua l('vaNetwo rkId'); | |
121 | expe ct(vaNetwo rkIdField. prop('labe l')).toEqu al('VA Net work ID'); | |
122 | expe ct(vaNetwo rkIdField. prop('labe lClassName ')).toEqua l('usa-sr- only'); | |
123 | expe ct(vaNetwo rkIdField. prop('info Text')).to Equal('req uired'); | |
124 | expe ct(vaNetwo rkIdField. prop('maxL ength')).t oEqual(VA_ NETWORK_ID _MAX_LENGT H); | |
125 | expe ct(vaNetwo rkIdField. prop('valu e')).toEqu al(user.va NetworkId) ; | |
126 | }); | |
127 | ||
128 | it('sh ould updat e the vaNe tworkId va lue on cha nge', () = > { | |
129 | vaNe tworkIdFie ld.prop('o nChange')( { | |
130 | ta rget: { | |
131 | name: vaNe tworkIdFie ld.prop('n ame'), | |
132 | value: 'VI EWERUSER' | |
133 | } | |
134 | }); | |
135 | ||
136 | expe ct(updateU ser).toBeC alledWith( extendClon e(user, { vaNetworkI d: 'VIEWER USER' })); | |
137 | }); | |
138 | }); | |
139 | ||
140 | describe ('Domain f ield', () => { | |
141 | let do mainField; | |
142 | ||
143 | before Each(() => { | |
144 | doma inField = wrapper.fi nd('Charac terCountIn put').at(2 ); | |
145 | }); | |
146 | ||
147 | it('sh ould use a Character CountInput component with the correct pr ops', () = > { | |
148 | expe ct(domainF ield.prop( 'inputId') ).toEqual( 'domain'); | |
149 | expe ct(domainF ield.prop( 'label')). toEqual('D omain'); | |
150 | expe ct(domainF ield.prop( 'labelClas sName')).t oEqual('us a-sr-only' ); | |
151 | expe ct(domainF ield.prop( 'infoText' )).toEqual ('required '); | |
152 | expe ct(domainF ield.prop( 'maxLength ')).toEqua l(DOMAIN_M AX_LENGTH) ; | |
153 | expe ct(domainF ield.prop( 'value')). toEqual(us er.domain) ; | |
154 | }); | |
155 | ||
156 | it('sh ould updat e the vaNe tworkId va lue on cha nge', () = > { | |
157 | doma inField.pr op('onChan ge')({ | |
158 | ta rget: { | |
159 | name: doma inField.pr op('inputI d'), | |
160 | value: 'NO TDEV' | |
161 | } | |
162 | }); | |
163 | ||
164 | expe ct(updateU ser).toBeC alledWith( extendClon e(user, { domain: 'N OTDEV' })) ; | |
165 | }); | |
166 | }); | |
167 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.