Produced by Araxis Merge on 3/12/2019 4:22:12 PM 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\CC CC SEOC 1.7\seocui-release1.7@bb33f84589b\cc_seoc_ui\src\components\user-management | UserScrollTable.spec.js | Tue Jan 29 13:55:38 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\Community Care Care Coordination SEOC 1.7-redacted\CC CC SEOC 1.7\seocui-release1.7@bb33f84589b\cc_seoc_ui\src\components\user-management | UserScrollTable.spec.js | Tue Mar 12 21:14:37 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 5 | 354 |
Changed | 4 | 12 |
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 { 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'; | |
5 | ||
6 | import Scr ollTable f rom '../sc roll-table /ScrollTab le'; | |
7 | import Use rScrollTab le from '. /UserScrol lTable'; | |
8 | import Use rTableHead er from '. /UserTable Header'; | |
9 | import Use rTable fro m './UserT able'; | |
10 | ||
11 | describe(' UserScroll Table Comp onent', () => { | |
12 | let wrap per; | |
13 | let inst ance; | |
14 | ||
15 | const sh owEdit = f alse; | |
16 | let user s = [{ | |
17 | id: 1, | |
18 | userName: ' RED A CTED ', | |
19 | role: 'Administr ator', | |
20 | vaNetworkI d: ' R E D A CTED ', | |
21 | domain: ' RE D ACT E D ' | |
22 | }]; | |
23 | ||
24 | let upda teUser; | |
25 | ||
26 | const us er = { | |
27 | userName: ' REDACTED ', | |
28 | role: 'Viewer', | |
29 | vaNetworkI d: ' R E DA C TED ', | |
30 | domain: ' RE D ACT E D ' | |
31 | }; | |
32 | ||
33 | const se lected = ' id1'; | |
34 | ||
35 | let upda teSelected ; | |
36 | let show Alert; | |
37 | let show InfoText; | |
38 | ||
39 | beforeEa ch(() => { | |
40 | update User = jes t.fn(); | |
41 | update Selected = jest.fn() ; | |
42 | showAl ert = fals e; | |
43 | showIn foText = f alse; | |
44 | ||
45 | window .innerHeig ht = 900; | |
46 | ||
47 | docume nt.querySe lector = j est.fn().m ockImpleme ntation((s elector) = > { | |
48 | let offsetWidt h = 0; | |
49 | let clientWidt h = 0; | |
50 | let offsetHeig ht; | |
51 | ||
52 | if ( selector.i ndexOf('.u ser-manage ment .usa- alert') != = -1) { | |
53 | if (!showAle rt) { | |
54 | return; | |
55 | } | |
56 | ||
57 | of fsetHeight = 200; | |
58 | } el se if (sel ector.inde xOf('.user -managemen t .require d-tag') != = -1) { | |
59 | if (!showInf oText) { | |
60 | return; | |
61 | } | |
62 | ||
63 | of fsetHeight = 50; | |
64 | } el se if (sel ector.inde xOf('.tabl e-scroll . user-table thead th: last-child ') !== -1) { | |
65 | of fsetWidth = 130; | |
66 | } el se if (sel ector.inde xOf('.tabl e-scroll') !== -1) { | |
67 | of fsetWidth = 900; | |
68 | cl ientWidth = 885; | |
69 | } el se if (sel ector.inde xOf('.seoc -fixed-hea der') !== -1) { | |
70 | of fsetHeight = 150; | |
71 | } el se if (sel ector.inde xOf('.user -scroll-ta ble > .seo c-table') !== -1) { | |
72 | of fsetHeight = 60; | |
73 | } el se if (sel ector.inde xOf('.seoc -fixed-foo ter') !== -1) { | |
74 | of fsetHeight = 50; | |
75 | } el se if (sel ector.inde xOf('.user -managemen t .usa-ale rt') !== - 1) { | |
76 | of fsetHeight = 200; | |
77 | } el se if (sel ector.inde xOf('.user -managemen t .require d-tag') != = -1 && sh owInfoText ) { | |
78 | of fsetHeight = 50; | |
79 | } | |
80 | ||
81 | retu rn { | |
82 | cl ientWidth, | |
83 | of fsetHeight , | |
84 | of fsetWidth, | |
85 | fo cus: jest. fn() | |
86 | }; | |
87 | }); | |
88 | ||
89 | wrappe r = mount( | |
90 | <Use rScrollTab le | |
91 | sh owEdit={ s howEdit } | |
92 | us ers={ user s } | |
93 | up dateUser={ updateUse r } | |
94 | us er={ user } | |
95 | up dateSelect ed={ updat eSelected } | |
96 | se lected={ s elected } />); | |
97 | instan ce = wrapp er.instanc e(); | |
98 | }); | |
99 | ||
100 | describe ('calculat eMaxHeight ', () => { | |
101 | it('sh ould calcu late the h eight of t he table-s croll elem ent', () = > { | |
102 | cons t actual = instance. calculateM axHeight() ; | |
103 | cons t expected = 630; | |
104 | ||
105 | expe ct(actual) .toEqual(e xpected); | |
106 | }); | |
107 | ||
108 | it('sh ould calcu late the h eight of t he table-s croll elem ent when a n alert an d info tex t are pres ent', () = > { | |
109 | show Alert = tr ue; | |
110 | show InfoText = true; | |
111 | ||
112 | cons t actual = instance. calculateM axHeight() ; | |
113 | cons t expected = 340; | |
114 | ||
115 | expe ct(actual) .toEqual(e xpected); | |
116 | }); | |
117 | }); | |
118 | ||
119 | describe ('ScrollTa ble elemen t', () => { | |
120 | let sc rollTable; | |
121 | ||
122 | before Each(() => { | |
123 | inst ance.calcu lateMaxHei ght = jest .fn(); | |
124 | inst ance.force Update(); | |
125 | ||
126 | scro llTable = wrapper.fi nd(ScrollT able); | |
127 | }); | |
128 | ||
129 | it('sh ould use a ScrollTab le element ', () => { | |
130 | cons t actual = scrollTab le.length; | |
131 | cons t expected = 1; | |
132 | ||
133 | expe ct(actual) .toEqual(e xpected); | |
134 | }); | |
135 | ||
136 | it('sh ould pass the correc t classNam e', () => { | |
137 | cons t actual = scrollTab le.prop('c lassName') ; | |
138 | cons t expected = 'user-s croll-tabl e'; | |
139 | ||
140 | expe ct(actual) .toEqual(e xpected); | |
141 | }); | |
142 | ||
143 | it('sh ould use t he UserTab leHeader', () => { | |
144 | let userTableH eader = wr apper.find (UserTable Header); | |
145 | ||
146 | cons t actual = userTable Header.len gth; | |
147 | cons t expected = 2; | |
148 | ||
149 | expe ct(actual) .toEqual(e xpected); | |
150 | }); | |
151 | ||
152 | it('sh ould pass the correc t headerPr ops', () = > { | |
153 | cons t actual = scrollTab le.prop('h eaderProps '); | |
154 | cons t expected = { | |
155 | sh owEdit, | |
156 | na meCharsLef t: USER_NA ME_MAX_LEN GTH - user .userName. length, | |
157 | ne tworkIdCha rsLeft: VA _NETWORK_I D_MAX_LENG TH - user. vaNetworkI d.length, | |
158 | do mainCharsL eft: DOMAI N_MAX_LENG TH - user. domain.len gth | |
159 | }; | |
160 | ||
161 | expe ct(actual) .toEqual(e xpected); | |
162 | }); | |
163 | ||
164 | it('sh ould pass the showEd it prop as noScroll' , () => { | |
165 | cons t actual = scrollTab le.prop('n oScroll'); | |
166 | cons t expected = showEdi t; | |
167 | ||
168 | expe ct(actual) .toEqual(e xpected); | |
169 | }); | |
170 | ||
171 | it('sh ould use t he UserTab le compone nt and pas s the corr ect props' , () => { | |
172 | let userTable = wrapper. find(UserT able); | |
173 | ||
174 | expe ct(userTab le.length) .toEqual(1 ); | |
175 | expe ct(userTab le.prop('s howEdit')) .toEqual(s howEdit); | |
176 | expe ct(userTab le.prop('u sers')).to Equal(user s); | |
177 | expe ct(userTab le.prop('u pdateUser' )).toEqual (updateUse r); | |
178 | expe ct(userTab le.prop('u ser')).toE qual(user) ; | |
179 | expe ct(userTab le.prop('u pdateSelec ted')).toE qual(updat eSelected) ; | |
180 | expe ct(userTab le.prop('s elected')) .toEqual(s elected); | |
181 | }); | |
182 | }); | |
183 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.