Produced by Araxis Merge on 5/10/2018 8:40:52 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 | MHED_APPS_CIF.zip\VAR v4.2.7\var-web-4.2.7@0810ae549c1.zip\veteran-appointment-requests\app\modules\new-appointment-request\tests\common\views | facility-layout-spec.js | Mon Apr 9 06:06:53 2018 UTC |
2 | MHED_APPS_CIF.zip\VAR v4.2.7\var-web-4.2.7@0810ae549c1.zip\veteran-appointment-requests\app\modules\new-appointment-request\tests\common\views | facility-layout-spec.js | Thu May 3 13:36:15 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 5 | 826 |
Changed | 4 | 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 | define([ | |
2 | 'under score', | |
3 | 'backb one', | |
4 | 'modul es/new-app ointment-r equest/res ources/com mon/model' , | |
5 | 'modul es/new-app ointment-r equest/res ources/com mon/facili ty/model', | |
6 | 'modul es/new-app ointment-r equest/vie ws/common/ facility/l ayout-view ', | |
7 | 'modul es/new-app ointment-r equest/tes ts/helpers /facility- helper', | |
8 | ], functio n(_, Backb one, BaseM odel, Faci lityModel, View, hel pers) { | |
9 | 'use s trict'; | |
10 | ||
11 | ||
12 | descri be('Schedu ling Facil ity Layout View', fu nction() { | |
13 | ||
14 | va r TYPE_OF_ CARE = 'Zo mbie Face Lifts'; | |
15 | ||
16 | // Example: WORCESTER CBOC (WORC ESTER, MA) | |
17 | // Example: any test n ame (ANYNA ME, XX) | |
18 | // The way t o display a facility | |
19 | va r REG_EXP = /^[a-zA- Z ]+ \([a- zA-Z]+, [A -Z]{2}\)$/ ; | |
20 | ||
21 | ||
22 | va r view; | |
23 | va r region; | |
24 | va r fetch; | |
25 | va r model; | |
26 | ||
27 | ||
28 | de scribe('Ba sic testin g and cove rage', fun ction() { | |
29 | beforeEa ch(functio n() { | |
30 | fetc h = helper s.collecti onFetchSpy (); | |
31 | mode l = new Ba seModel({ | |
32 | typeOfCare : new Back bone.Model ({ | |
33 | id: '0 ', | |
34 | name: 'whatever' , | |
35 | }), | |
36 | }); | |
37 | ||
38 | spyO n(View.pro totype, 's howRegions ').and.cal lFake(_.no op); | |
39 | view = new Vie w({model: model}); | |
40 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
41 | }); | |
42 | ||
43 | it('fetc hes on cre ation', fu nction() { | |
44 | expe ct(fetch). toHaveBeen Called(); | |
45 | }); | |
46 | ||
47 | it('trig gers show after fetc h', functi on() { | |
48 | view .collectio n.trigger( 'fetch:suc cess'); | |
49 | expe ct(view.sh owRegions) .toHaveBee nCalled(); | |
50 | }); | |
51 | ||
52 | it('does not show the sectio n region i f the coll ection is empty', fu nction () { | |
53 | var section; | |
54 | ||
55 | view .collectio n.reset(); | |
56 | view .showBody( ); | |
57 | sect ion = view .getRegion s('section '); | |
58 | ||
59 | expe ct(section .currentVi ew).toBeUn defined(); | |
60 | }); | |
61 | }) ; | |
62 | ||
63 | ||
64 | /* * | |
65 | * https:// issues.mob ilehealth. DNS /browse/VA R-7864 | |
66 | * | |
67 | * As a user | |
68 | * I want to be able t o select t he specifi c location where I w ant to rec eive care | |
69 | * So that m y booking process is streamlin ed focuses on a smal ler number of specif ic clinics | |
70 | * | |
71 | * When a us er views t he New App ointment/R equest for m, the “ro uting ques tions” sho wn at the top part o f the form | |
72 | * are revis ed to acco mmodate lo cation lev el booking as follow s: | |
73 | * / | |
74 | de scribe('Sp ecificatio n Tests fo r VAR-7865 ', functio n() { | |
75 | beforeEa ch(functio n() { | |
76 | regi on = helpe rs.setupTe stingRegio n(); | |
77 | fetc h = helper s.collecti onFetchSpy (); | |
78 | mode l = new Ba seModel({ | |
79 | typeOfCare : new Back bone.Model ({ | |
80 | id: '0 ', | |
81 | name: 'whatever' , | |
82 | }), | |
83 | pacTeam: n ew Backbon e.Collecti on(), | |
84 | }); | |
85 | view = new Vie w({ | |
86 | model: mod el, | |
87 | typeOfCare Name: TYPE _OF_CARE, | |
88 | }); | |
89 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
90 | regi on.show(vi ew); | |
91 | }); | |
92 | ||
93 | afterEac h(helpers. resetTesti ngRegion); | |
94 | ||
95 | /** | |
96 | * 1. La bel: Step 2: Select Location | |
97 | */ | |
98 | describe ('1.0.0 - 1.0.0', fu nction() { | |
99 | it(' shows the correct la bel', func tion() { | |
100 | var headin g; | |
101 | var legend ; | |
102 | var text; | |
103 | ||
104 | view.showR egions(); | |
105 | heading = view.getRe gion('head ing').curr entView.el ; | |
106 | legend = _ .first(hea ding.getEl ementsByTa gName('leg end')); | |
107 | text = leg end.innerT ext; | |
108 | ||
109 | expect(tex t).toBe('S tep 2: Loc ation'); | |
110 | }); | |
111 | }); | |
112 | ||
113 | ||
114 | /** | |
115 | * 2. Instructio nal text: The follow ing facili ty locatio ns support schedulin g <Type of care sele cted> | |
116 | * appointmen ts through this app. If you ca nnot find the locati on you nee d, please visit the | |
117 | * [VA Facili ty Locator ] to conta ct the fac ility for assistance . | |
118 | * | |
119 | * 2.2. Hyp erlink “VA Facility Locator” t o: https:/ /www. DNS /directory /guide/div ision.asp? dnum=1 | |
120 | */ | |
121 | describe ('2.0.0 - 2.2.0', fu nction() { | |
122 | var text; | |
123 | ||
124 | befo reEach(fun ction() { | |
125 | var headin g; | |
126 | var instru ctions; | |
127 | ||
128 | view.showR egions(); | |
129 | heading = view.getRe gion('head ing').curr entView.el ; | |
130 | instructio ns = _.fir st(heading .getElemen tsByTagNam e('p')); | |
131 | text = ins tructions. innerHTML. trim(); | |
132 | }); | |
133 | ||
134 | it(' creates th e basic in structions ', functio n() { | |
135 | expect(tex t.indexOf( 'The follo wing facil ity locati ons ')).to Be(0); | |
136 | }); | |
137 | ||
138 | it(' includes t he type of care sele cted in th e instruct ions', fun ction() { | |
139 | expect(tex t.indexOf( TYPE_OF_CA RE)).toBeG reaterThan (-1); | |
140 | }); | |
141 | ||
142 | it(' includes t he help ur l in the i nstruction s', functi on() { | |
143 | expect(tex t.indexOf( view.HELP_ TEXT)).toB eGreaterTh an(-1); | |
144 | }); | |
145 | }); | |
146 | ||
147 | ||
148 | /** | |
149 | * 3. Label: S elect the location y ou want to visit: | |
150 | * | |
151 | * 3.1 Drop dow n list box | |
152 | * | |
153 | * 3.2 Values: Default dr op down li st will di splay all locations (including , children /divisions and the | |
154 | * parent s ite(s) its elf) under the paren t site(s) associated with the user’s aut henticatio n | |
155 | * credenti als where that type of care ha s been des ignated as supported in the ut ility for direct | |
156 | * scheduli ng, reques ts, or bot h methods of schedul ing. | |
157 | * | |
158 | * 3.2.1 Display format sho uld includ e a “frien dly” name configured in the Ut ility, fol lowed by t he city | |
159 | * and stat e for that location in parenth esis | |
160 | * | |
161 | * 3.2.2 Example: Boston VA MC (Boston , MA) | |
162 | * | |
163 | * 3.2.4 . Sort the locations alphabeti cally by S tate, then City, the n Location Name | |
164 | * | |
165 | */ | |
166 | describe ('3.0.0 - 3.2.4', fu nction() { | |
167 | var el; | |
168 | ||
169 | befo reEach(fun ction() { | |
170 | view.showR egions(); | |
171 | el = view. getRegion( 'section') .currentVi ew.el; | |
172 | }); | |
173 | ||
174 | it(' shows the correct la bel for th e dropdown ', functio n() { | |
175 | var label = _.first( el.getElem entsByTagN ame('label ')); | |
176 | var text = label.inn erText; | |
177 | ||
178 | // The * i s because it is a re quired fie ld. | |
179 | expect(tex t).toBe('* Select th e location you want to visit:' ); | |
180 | }); | |
181 | ||
182 | it(' populates the dropdo wn', funct ion() { | |
183 | var option s = el.get ElementsBy TagName('o ption'); | |
184 | ||
185 | // There a re three i tems in th e collecti on and a p laceholder item that reads "Se lect" | |
186 | expect(opt ions.lengt h).toBe(4) ; | |
187 | }); | |
188 | ||
189 | it(' uses the f ormat FRIE NDLY_NAME (CITY, STA TE) for ea ch dropdow n Item', f unction() { | |
190 | var option s = el.get ElementsBy TagName('o ption'); | |
191 | var last = _.last(op tions); | |
192 | var text = last.inne rText.trim (); | |
193 | ||
194 | expect(tex t).toMatch (REG_EXP); | |
195 | }); | |
196 | ||
197 | // T ODO this i s going to change to group by city/state then alph abetical | |
198 | it(' should sho rt the dro pdown alph abetically ', functio n() { | |
199 | var _optio ns = el.ge tElementsB yTagName(' option'); | |
200 | var option s = Array. prototype. slice.call (_options) ; | |
201 | var last; | |
202 | var isPass ing; | |
203 | var next; | |
204 | ||
205 | options.sh ift(); | |
206 | ||
207 | last = opt ions.shift (); | |
208 | isPassing = true; | |
209 | ||
210 | while (opt ions.lengt h) { | |
211 | next = options.s hift(); | |
212 | if (ne xt.innerTe xt.localeC ompare(las t.innerTex t) < 1) { | |
213 | is Passing = false; | |
214 | br eak; | |
215 | } | |
216 | last = next; | |
217 | } | |
218 | ||
219 | expect(isP assing).to BeTruthy() ; | |
220 | }); | |
221 | }); | |
222 | ||
223 | ||
224 | /** | |
225 | * 4. If only on e location is availa ble, selec t that opt ion by def ault and d isplay: | |
226 | * | |
227 | * 4.1. Instructio nal text: One locati on support s scheduli ng <insert type of c are> appoi ntments th rough this | |
228 | * app. | |
229 | * | |
230 | * 4.2. Display lo cation nam e (city, s tate) | |
231 | */ | |
232 | describe ('4.0.0 - 4.2.0', fu nction() { | |
233 | var el; | |
234 | ||
235 | befo reEach(fun ction() { | |
236 | view.colle ction.shif t(); | |
237 | view.colle ction.shif t(); | |
238 | view.showR egions(); | |
239 | el = view. el; | |
240 | }); | |
241 | ||
242 | it(' shows the correct in structions for when there is o nly one ma tching fac ility', fu nction() { | |
243 | var p = _. first(el.g etElements ByTagName( 'p')); | |
244 | var text = p.innerTe xt.trim(); | |
245 | ||
246 | ||
247 | expect(tex t.indexOf( 'One locat ion suppor ts schedul ing')).toB e(0); | |
248 | expect(tex t.indexOf( TYPE_OF_CA RE)).toBeG reaterThan (-1); | |
249 | }); | |
250 | ||
251 | it(' displays t he name of the facil ity in the format: N AME (CITY, STATE)', function() { | |
252 | var span = _.last(el .getElemen tsByTagNam e('span')) ; | |
253 | var text = span.inne rText.trim (); | |
254 | expect(tex t).toMatch (REG_EXP); | |
255 | }); | |
256 | }); | |
257 | ||
258 | ||
259 | /** | |
260 | * 5. If no loca tions are found wher e the care is suppor ted, displ ay: | |
261 | * | |
262 | * 5.1. Unfortunat ely, there are no lo cations wh ere you ar e register ed that ar e offering primary c are | |
263 | * through th is app. | |
264 | */ | |
265 | describe ('5.0.0 - 5.1.0', fu nction() { | |
266 | it(' generates the correc t instruct ions where there are no facili ties', fun ction() { | |
267 | var instru ctions; | |
268 | var frag; | |
269 | var anchor s; | |
270 | var anchor ; | |
271 | ||
272 | view.colle ction.rese t(); | |
273 | instructio ns = view. getInstruc tions(); | |
274 | frag = doc ument.crea teElement( 'div'); | |
275 | frag.inner HTML = ins tructions; | |
276 | anchors = frag.getEl ementsByTa gName('a') ; | |
277 | anchor = _ .first(anc hors); | |
278 | ||
279 | // Shows a n error me ssage and displays a link to a help page . | |
280 | expect(ins tructions) .toContain ('Unfortun ately'); | |
281 | expect(anc hor.href). toEqual('h ttps://www . DNS /directory /guide/div ision.asp? dnum=1'); | |
282 | }); | |
283 | }); | |
284 | }) ; | |
285 | ||
286 | /* * | |
287 | * https:// issues.mob ilehealth. DNS /browse/VA R-8702 | |
288 | * | |
289 | * Given a u ser has se lected Exp ress Care from the T ype of Car e drop dow n, when th e user | |
290 | * selects a location (or the de fault loca tion is di splayed), display th e followin g text | |
291 | * below the location selection question: Express Ca re request at this l ocation mu st be | |
292 | * submitted before <e nd time> < time zone> . | |
293 | * / | |
294 | de scribe('Sp ecificatio n Tests fo r VAR-8702 ', functio n() { | |
295 | var time ; | |
296 | var faci lityModel; | |
297 | var expe ctedText; | |
298 | ||
299 | beforeEa ch(functio n() { | |
300 | time = '13:00 EST'; | |
301 | faci lityModel = new Faci lityModel( { | |
302 | expressTim es: { | |
303 | start: '08:00', | |
304 | end: ' 13:00', | |
305 | timezo ne: 'EST', | |
306 | offset Utc: '-05: 00', | |
307 | }, | |
308 | }, { parse: tru e}); | |
309 | expe ctedText = 'Express Care reque st at this location must be su bmitted be fore ' + t ime + '.'; | |
310 | }); | |
311 | ||
312 | describe ('facility layout vi ew', funct ion() { | |
313 | it(' generates the correc t express message fo r a single facility' , function () { | |
314 | var _view = new View ({ | |
315 | model: new BaseM odel({ | |
316 | ty peOfCare: new Backbo ne.Model({ | |
317 | id: 'CR1 ', | |
318 | name: 'w hatever', | |
319 | }) , | |
320 | }), | |
321 | typeOf CareName: TYPE_OF_CA RE, | |
322 | }); | |
323 | var output = _view.g etExpressM essage('CR 1', facili tyModel); | |
324 | ||
325 | expect(out put).toBe( expectedTe xt); | |
326 | }); | |
327 | }); | |
328 | ||
329 | describe ('facility section v iew', func tion() { | |
330 | var sectionVie w; | |
331 | ||
332 | befo reEach(fun ction() { | |
333 | var sectio nRegion; | |
334 | ||
335 | region = h elpers.set upTestingR egion(); | |
336 | fetch = he lpers.coll ectionFetc hSpy(); | |
337 | model = ne w BaseMode l({ | |
338 | typeOf Care: new Backbone.M odel({ | |
339 | id : 'CR1', | |
340 | na me: 'whate ver', | |
341 | }), | |
342 | pacTea m: new Bac kbone.Coll ection(), | |
343 | }); | |
344 | view = new View({ | |
345 | model: model, | |
346 | typeOf CareName: TYPE_OF_CA RE, | |
347 | }); | |
348 | view.colle ction.set( helpers.mo ckPatientF acility(), {parse: t rue}); | |
349 | region.sho w(view); | |
350 | view.showR egions(); | |
351 | ||
352 | sectionReg ion = view .getRegion ('section' ); | |
353 | sectionVie w = sectio nRegion.cu rrentView; | |
354 | }); | |
355 | ||
356 | afte rEach(help ers.resetT estingRegi on); | |
357 | ||
358 | it(' appends th e dom with the expre ss message after fac ility is s elected', function() { | |
359 | var output ; | |
360 | ||
361 | sectionVie w._insertE xpressCare Message(fa cilityMode l); | |
362 | output = s ectionView .ui.expres s.text(); | |
363 | ||
364 | expect(out put).toBe( expectedTe xt); | |
365 | }); | |
366 | }); | |
367 | }) ; | |
368 | ||
369 | de scribe('Se ction View Test', fu nction() { | |
370 | var sect ionView; | |
371 | ||
372 | beforeEa ch(functio n() { | |
373 | var sectionReg ion; | |
374 | ||
375 | regi on = helpe rs.setupTe stingRegio n(); | |
376 | fetc h = helper s.collecti onFetchSpy (); | |
377 | mode l = new Ba seModel({ | |
378 | typeOfCare : new Back bone.Model ({ | |
379 | id: '0 ', | |
380 | name: 'whatever' , | |
381 | }), | |
382 | pacTeam: n ew Backbon e.Collecti on(), | |
383 | }); | |
384 | ||
385 | view = new Vie w({ | |
386 | model: mod el, | |
387 | typeOfCare Name: TYPE _OF_CARE, | |
388 | }); | |
389 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
390 | regi on.show(vi ew); | |
391 | view .showRegio ns(); | |
392 | ||
393 | sect ionRegion = view.get Region('se ction'); | |
394 | sect ionView = sectionReg ion.curren tView; | |
395 | }); | |
396 | ||
397 | afterEac h(helpers. resetTesti ngRegion); | |
398 | ||
399 | it('upda tes its mo del on a c ollection change', f unction() { | |
400 | var isCalled = false; | |
401 | var id = 'myVa lue'; | |
402 | var value = vi ew.collect ion.first( ).get('ins titutionCo de'); | |
403 | ||
404 | view .listenTo( view.model , 'change: myValue', function() { | |
405 | isCalled = true; | |
406 | }); | |
407 | ||
408 | sect ionView.co llection.t rigger('ch ange:value ', new Bac kbone.Mode l({ | |
409 | id: id, | |
410 | value: val ue, | |
411 | })); | |
412 | ||
413 | expe ct(isCalle d).toBeTru thy(); | |
414 | }); | |
415 | }) ; | |
416 | }); | |
417 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.