Produced by Araxis Merge on 5/30/2019 1:49:18 PM Eastern 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 | var_web_release_4_18.zip\var_web_release_4_8_ebb0ab2774d.zip\veteran-appointment-requests\app\modules\new-appointment-request\tests\common\views | facility-layout-spec.js | Fri May 10 18:55:49 2019 UTC |
| 2 | var_web_release_4_18.zip\var_web_release_4_8_ebb0ab2774d.zip\veteran-appointment-requests\app\modules\new-appointment-request\tests\common\views | facility-layout-spec.js | Thu May 30 00:01:20 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 1074 |
| Changed | 3 | 6 |
| 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/vie ws/common/ facility/s ection-vie w', | |
| 8 | 'modul es/new-app ointment-r equest/tes ts/helpers /facility- helper', | |
| 9 | 'modul es/new-app ointment-r equest/res ources/dir ect/clinic s/collecti on', | |
| 10 | 'modul es/new-app ointment-r equest/res ources/com mon/pac-te am/collect ion', | |
| 11 | ], functio n(_, Backb one, BaseM odel, Faci lityModel, View, Sec tionView, helpers, C linicsColl ection, Pa cTeamColle ction) { | |
| 12 | 'use s trict'; | |
| 13 | ||
| 14 | ||
| 15 | descri be('Schedu ling Facil ity Layout View', fu nction() { | |
| 16 | ||
| 17 | va r TYPE_OF_ CARE = 'Zo mbie Face Lifts'; | |
| 18 | ||
| 19 | // Example: WORCESTER CBOC (WORC ESTER, MA) | |
| 20 | // Example: any test n ame (ANYNA ME, XX) | |
| 21 | // The way t o display a facility | |
| 22 | va r REG_EXP = /^[a-zA- Z ]+ \([a- zA-Z]+, [A -Z]{2}\)$/ ; | |
| 23 | ||
| 24 | ||
| 25 | va r view; | |
| 26 | va r region; | |
| 27 | va r fetch; | |
| 28 | va r model; | |
| 29 | ||
| 30 | va r prepareC linicsColl ection = f unction(la youtView) { | |
| 31 | var clin icsCallbac k = new $. Deferred() ; | |
| 32 | clinicsC allback.re solve([]); | |
| 33 | layoutVi ew.clinics Collection = new Cli nicsCollec tion(); | |
| 34 | spyOn(la youtView.c linicsColl ection, 'f etchAllCli nics').and .returnVal ue(clinics Callback); | |
| 35 | layoutVi ew.model.s et('unfilt eredClinic s', []); | |
| 36 | }; | |
| 37 | ||
| 38 | va r createMo del = func tion() { | |
| 39 | var retv al; | |
| 40 | var pacT eamMock = new PacTea mCollectio n(); | |
| 41 | var form Model = ne w Backbone .Collectio n(); | |
| 42 | formMode l.set('fac ilityCode' , 123); | |
| 43 | spyOn(pa cTeamMock, 'hasPacTe amAtFacili ty').and.r eturnValue (false); | |
| 44 | retval = new BaseM odel({ | |
| 45 | type OfCare: ne w Backbone .Model({ | |
| 46 | id: 'CR1', | |
| 47 | name: 'wha tever', | |
| 48 | }), | |
| 49 | pacT eam: pacTe amMock, | |
| 50 | city State: new Backbone. Model(), | |
| 51 | form Model: for mModel, | |
| 52 | }); | |
| 53 | ||
| 54 | return r etval; | |
| 55 | }; | |
| 56 | ||
| 57 | ||
| 58 | de scribe('Ba sic testin g and cove rage', fun ction() { | |
| 59 | beforeEa ch(functio n() { | |
| 60 | fetc h = helper s.collecti onFetchSpy (); | |
| 61 | mode l = create Model(); | |
| 62 | ||
| 63 | spyO n(View.pro totype, 's howRegions ').and.cal lFake(_.no op); | |
| 64 | view = new Vie w({model: model}); | |
| 65 | prep areClinics Collection (view); | |
| 66 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
| 67 | }); | |
| 68 | ||
| 69 | it('fetc hes on cre ation', fu nction() { | |
| 70 | expe ct(fetch). toHaveBeen Called(); | |
| 71 | }); | |
| 72 | ||
| 73 | it('trig gers show after fetc h', functi on() { | |
| 74 | view .collectio n.trigger( 'fetch:suc cess'); | |
| 75 | expe ct(view.sh owRegions) .toHaveBee nCalled(); | |
| 76 | }); | |
| 77 | ||
| 78 | it('does not show the sectio n region i f the coll ection is empty', fu nction () { | |
| 79 | var section; | |
| 80 | ||
| 81 | view .collectio n.reset(); | |
| 82 | view .showBody( ); | |
| 83 | sect ion = view .getRegion s('section '); | |
| 84 | ||
| 85 | expe ct(section .currentVi ew).toBeUn defined(); | |
| 86 | }); | |
| 87 | }) ; | |
| 88 | ||
| 89 | ||
| 90 | /* * | |
| 91 | * https:// DNS . URL /browse/VA R-7864 | |
| 92 | * | |
| 93 | * As a user | |
| 94 | * I want to be able t o select t he specifi c location where I w ant to rec eive care | |
| 95 | * So that m y booking process is streamlin ed focuses on a smal ler number of specif ic clinics | |
| 96 | * | |
| 97 | * 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 | |
| 98 | * are revis ed to acco mmodate lo cation lev el booking as follow s: | |
| 99 | * / | |
| 100 | de scribe('Sp ecificatio n Tests fo r VAR-7865 ', functio n() { | |
| 101 | var gas; | |
| 102 | ||
| 103 | beforeEa ch(functio n() { | |
| 104 | regi on = helpe rs.setupTe stingRegio n(); | |
| 105 | fetc h = helper s.collecti onFetchSpy (); | |
| 106 | mode l = create Model(); | |
| 107 | view = new Vie w({ | |
| 108 | model: mod el, | |
| 109 | typeOfCare Name: TYPE _OF_CARE, | |
| 110 | googleAnal yticsProvi der: { | |
| 111 | getIns tance: fun ction() { | |
| 112 | ga s = jasmin e.createSp yObj('gas' , ['gas']) ; | |
| 113 | re turn gas; | |
| 114 | }, | |
| 115 | }, | |
| 116 | }); | |
| 117 | prep areClinics Collection (view); | |
| 118 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
| 119 | regi on.show(vi ew); | |
| 120 | }); | |
| 121 | ||
| 122 | afterEac h(helpers. resetTesti ngRegion); | |
| 123 | ||
| 124 | /** | |
| 125 | * 1. La bel: Step 2: Select Location | |
| 126 | */ | |
| 127 | describe ('1.0.0 - 1.0.0', fu nction() { | |
| 128 | it(' shows the correct la bel', func tion() { | |
| 129 | var headin g; | |
| 130 | var legend ; | |
| 131 | var text; | |
| 132 | ||
| 133 | view.showR egions(); | |
| 134 | heading = view.getRe gion('head ing').curr entView.el ; | |
| 135 | legend = _ .first(hea ding.getEl ementsByTa gName('leg end')); | |
| 136 | text = leg end.innerT ext; | |
| 137 | ||
| 138 | expect(tex t).toBe('S tep 3: Loc ation'); | |
| 139 | }); | |
| 140 | }); | |
| 141 | ||
| 142 | ||
| 143 | /** | |
| 144 | * 2. Instructio nal text: The follow ing facili ty locatio ns support schedulin g <Type of care sele cted> | |
| 145 | * appointmen ts through this app. If you ca nnot find the locati on you nee d, please visit the | |
| 146 | * [VA Facili ty Locator ] to conta ct the fac ility for assistance . | |
| 147 | * | |
| 148 | * 2.2. Hyp erlink “VA Facility Locator” t o: https:/ / DNS . URL /directory /guide/div ision.asp? dnum=1 | |
| 149 | */ | |
| 150 | describe ('2.0.0 - 2.2.0', fu nction() { | |
| 151 | var text; | |
| 152 | ||
| 153 | befo reEach(fun ction() { | |
| 154 | var headin g; | |
| 155 | var instru ctions; | |
| 156 | ||
| 157 | view.showR egions(); | |
| 158 | heading = view.getRe gion('head ing').curr entView.el ; | |
| 159 | instructio ns = _.fir st(heading .getElemen tsByTagNam e('p')); | |
| 160 | text = ins tructions. innerHTML. trim(); | |
| 161 | }); | |
| 162 | ||
| 163 | it(' creates th e basic in structions ', functio n() { | |
| 164 | expect(tex t.indexOf( 'The follo wing facil ity locati ons ')).to Be(0); | |
| 165 | }); | |
| 166 | ||
| 167 | it(' includes t he type of care sele cted in th e instruct ions', fun ction() { | |
| 168 | expect(tex t.indexOf( TYPE_OF_CA RE)).toBeG reaterThan (-1); | |
| 169 | }); | |
| 170 | ||
| 171 | it(' includes t he help ur l in the i nstruction s', functi on() { | |
| 172 | expect(tex t.indexOf( view.HELP_ TEXT)).toB eGreaterTh an(-1); | |
| 173 | }); | |
| 174 | }); | |
| 175 | ||
| 176 | ||
| 177 | /** | |
| 178 | * 3. Label: S elect the location y ou want to visit: | |
| 179 | * | |
| 180 | * 3.1 Drop dow n list box | |
| 181 | * | |
| 182 | * 3.2 Values: Default dr op down li st will di splay all locations (including , children /divisions and the | |
| 183 | * parent s ite(s) its elf) under the paren t site(s) associated with the user’s aut henticatio n | |
| 184 | * credenti als where that type of care ha s been des ignated as supported in the ut ility for direct | |
| 185 | * scheduli ng, reques ts, or bot h methods of schedul ing. | |
| 186 | * | |
| 187 | * 3.2.1 Display format sho uld includ e a “frien dly” name configured in the Ut ility, fol lowed by t he city | |
| 188 | * and stat e for that location in parenth esis | |
| 189 | * | |
| 190 | * 3.2.2 Example: Boston VA MC (Boston , MA) | |
| 191 | * | |
| 192 | * 3.2.4 . Sort the locations alphabeti cally by S tate, then City, the n Location Name | |
| 193 | * | |
| 194 | */ | |
| 195 | describe ('3.0.0 - 3.2.4', fu nction() { | |
| 196 | var el; | |
| 197 | ||
| 198 | befo reEach(fun ction() { | |
| 199 | view.showR egions(); | |
| 200 | el = view. getRegion( 'section') .currentVi ew.el; | |
| 201 | }); | |
| 202 | ||
| 203 | it(' shows the correct la bel for th e dropdown ', functio n() { | |
| 204 | var label = _.first( el.getElem entsByTagN ame('label ')); | |
| 205 | var text = label.inn erText; | |
| 206 | ||
| 207 | // The * i s because it is a re quired fie ld. | |
| 208 | expect(tex t).toBe('* Select th e location you want to visit:' ); | |
| 209 | }); | |
| 210 | ||
| 211 | it(' populates the dropdo wn', funct ion() { | |
| 212 | var option s = el.get ElementsBy TagName('o ption'); | |
| 213 | ||
| 214 | // There a re three i tems in th e collecti on and a p laceholder item that reads 'Se lect' | |
| 215 | expect(opt ions.lengt h).toBe(4) ; | |
| 216 | }); | |
| 217 | ||
| 218 | it(' uses the f ormat FRIE NDLY_NAME (CITY, STA TE) for ea ch dropdow n Item', f unction() { | |
| 219 | var option s = el.get ElementsBy TagName('o ption'); | |
| 220 | var last = _.last(op tions); | |
| 221 | var text = last.inne rText.trim (); | |
| 222 | ||
| 223 | expect(tex t).toMatch (REG_EXP); | |
| 224 | }); | |
| 225 | ||
| 226 | // T ODO this i s going to change to group by city/state then alph abetical | |
| 227 | it(' should sho rt the dro pdown alph abetically ', functio n() { | |
| 228 | var _optio ns = el.ge tElementsB yTagName(' option'); | |
| 229 | var option s = Array. prototype. slice.call (_options) ; | |
| 230 | var last; | |
| 231 | var isPass ing; | |
| 232 | var next; | |
| 233 | ||
| 234 | options.sh ift(); | |
| 235 | ||
| 236 | last = opt ions.shift (); | |
| 237 | isPassing = true; | |
| 238 | ||
| 239 | while (opt ions.lengt h) { | |
| 240 | next = options.s hift(); | |
| 241 | if (ne xt.innerTe xt.localeC ompare(las t.innerTex t) < 1) { | |
| 242 | is Passing = false; | |
| 243 | br eak; | |
| 244 | } | |
| 245 | last = next; | |
| 246 | } | |
| 247 | ||
| 248 | expect(isP assing).to BeTruthy() ; | |
| 249 | }); | |
| 250 | }); | |
| 251 | ||
| 252 | ||
| 253 | /** | |
| 254 | * 4. If only on e location is availa ble, selec t that opt ion by def ault and d isplay: | |
| 255 | * | |
| 256 | * 4.1. Instructio nal text: One locati on support s scheduli ng <insert type of c are> appoi ntments th rough this | |
| 257 | * app. | |
| 258 | * | |
| 259 | * 4.2. Display lo cation nam e (city, s tate) | |
| 260 | */ | |
| 261 | describe ('4.0.0 - 4.2.0', fu nction() { | |
| 262 | var spy; | |
| 263 | var dummyRetur nView = ne w Backbone .View(); | |
| 264 | var el; | |
| 265 | ||
| 266 | befo reEach(fun ction() { | |
| 267 | view.colle ction.shif t(); | |
| 268 | view.colle ction.shif t(); | |
| 269 | spy = spyO n(view, 'g etSingleIt emView').a nd.returnV alue(dummy ReturnView ); | |
| 270 | view.showR egions(); | |
| 271 | el = view. el; | |
| 272 | }); | |
| 273 | ||
| 274 | it(' shows the correct in structions for when there is o nly one ma tching fac ility', fu nction() { | |
| 275 | var p = _. first(el.g etElements ByTagName( 'p')); | |
| 276 | var text = p.innerTe xt.trim(); | |
| 277 | ||
| 278 | expect(tex t.indexOf( 'One locat ion suppor ts schedul ing')).toB e(0); | |
| 279 | expect(tex t.indexOf( TYPE_OF_CA RE)).toBeG reaterThan (-1); | |
| 280 | expect(spy ).toHaveBe enCalled() ; | |
| 281 | }); | |
| 282 | ||
| 283 | // i t('display s the name of the fa cility in the format : NAME (CI TY, STATE) ', functio n() { | |
| 284 | // var spa n = _.last (el.getEle mentsByTag Name('span ')); | |
| 285 | // var tex t = span.i nnerText.t rim(); | |
| 286 | // expect( text).toMa tch(REG_EX P); | |
| 287 | // } ); | |
| 288 | }); | |
| 289 | ||
| 290 | ||
| 291 | /** | |
| 292 | * 5. If no loca tions are found wher e the care is suppor ted, displ ay: | |
| 293 | * | |
| 294 | * 5.1. Unfortunat ely, there are no lo cations wh ere you ar e register ed that ar e offering primary c are | |
| 295 | * through th is app. | |
| 296 | */ | |
| 297 | describe ('5.0.0 - 5.1.0', fu nction() { | |
| 298 | it(' generates the correc t instruct ions where there are no facili ties', fun ction() { | |
| 299 | var instru ctions; | |
| 300 | var frag; | |
| 301 | ||
| 302 | view.colle ction.rese t(); | |
| 303 | instructio ns = view. getInstruc tions(); | |
| 304 | frag = doc ument.crea teElement( 'div'); | |
| 305 | frag.inner HTML = ins tructions; | |
| 306 | ||
| 307 | // Shows a n error me ssage and displays a link to a help page . | |
| 308 | expect(ins tructions) .toContain ('Unfortun ately'); | |
| 309 | }); | |
| 310 | }); | |
| 311 | }) ; | |
| 312 | ||
| 313 | /* * | |
| 314 | * https:// DNS . URL /browse/VA R-8702 | |
| 315 | * | |
| 316 | * Given a u ser has se lected Exp ress Care from the T ype of Car e drop dow n, when th e user | |
| 317 | * selects a location (or the de fault loca tion is di splayed), display th e followin g text | |
| 318 | * below the location selection question: Express Ca re request at this l ocation mu st be | |
| 319 | * submitted before <e nd time> < time zone> . | |
| 320 | * / | |
| 321 | de scribe('Sp ecificatio n Tests fo r VAR-8702 ', functio n() { | |
| 322 | var time ; | |
| 323 | var faci lityModel; | |
| 324 | var expe ctedText; | |
| 325 | ||
| 326 | beforeEa ch(functio n() { | |
| 327 | time = '13:00 EST'; | |
| 328 | faci lityModel = new Faci lityModel( { | |
| 329 | expressTim es: { | |
| 330 | start: '08:00', | |
| 331 | end: ' 13:00', | |
| 332 | timezo ne: 'EST', | |
| 333 | offset Utc: '-05: 00', | |
| 334 | }, | |
| 335 | }, { parse: tru e}); | |
| 336 | expe ctedText = 'Express Care reque st at this location must be su bmitted be fore ' + t ime + '.'; | |
| 337 | }); | |
| 338 | ||
| 339 | describe ('facility layout vi ew', funct ion() { | |
| 340 | it(' generates the correc t express message fo r a single facility' , function () { | |
| 341 | var _view = new View ({ | |
| 342 | model: new BaseM odel({ | |
| 343 | ty peOfCare: new Backbo ne.Model({ | |
| 344 | id: 'CR1 ', | |
| 345 | name: 'w hatever', | |
| 346 | }) , | |
| 347 | ci tyState: n ew Backbon e.Model(), | |
| 348 | }), | |
| 349 | typeOf CareName: TYPE_OF_CA RE, | |
| 350 | }); | |
| 351 | var output = _view.g etExpressM essage('CR 1', facili tyModel); | |
| 352 | prepareCli nicsCollec tion(view) ; | |
| 353 | ||
| 354 | expect(out put).toBe( expectedTe xt); | |
| 355 | }); | |
| 356 | }); | |
| 357 | ||
| 358 | describe ('facility section v iew', func tion() { | |
| 359 | var sectionVie w; | |
| 360 | var gas; | |
| 361 | ||
| 362 | befo reEach(fun ction() { | |
| 363 | var sectio nRegion; | |
| 364 | ||
| 365 | region = h elpers.set upTestingR egion(); | |
| 366 | fetch = he lpers.coll ectionFetc hSpy(); | |
| 367 | model = cr eateModel( ); | |
| 368 | view = new View({ | |
| 369 | model: model, | |
| 370 | typeOf CareName: TYPE_OF_CA RE, | |
| 371 | google AnalyticsP rovider: { | |
| 372 | ge tInstance: function( ) { | |
| 373 | gas = ja smine.crea teSpyObj(' gas', ['ga s']); | |
| 374 | return g as; | |
| 375 | }, | |
| 376 | }, | |
| 377 | }); | |
| 378 | prepareCli nicsCollec tion(view) ; | |
| 379 | view.colle ction.set( helpers.mo ckPatientF acility(), {parse: t rue}); | |
| 380 | region.sho w(view); | |
| 381 | view.showR egions(); | |
| 382 | ||
| 383 | sectionReg ion = view .getRegion ('section' ); | |
| 384 | sectionVie w = sectio nRegion.cu rrentView; | |
| 385 | }); | |
| 386 | ||
| 387 | afte rEach(help ers.resetT estingRegi on); | |
| 388 | ||
| 389 | it(' appends th e dom with the expre ss message after fac ility is s elected', function() { | |
| 390 | var output ; | |
| 391 | ||
| 392 | sectionVie w._insertE xpressCare Message(fa cilityMode l); | |
| 393 | output = s ectionView .ui.expres s.text(); | |
| 394 | ||
| 395 | expect(out put).toBe( expectedTe xt); | |
| 396 | }); | |
| 397 | }); | |
| 398 | }) ; | |
| 399 | ||
| 400 | de scribe('Se ction View Test', fu nction() { | |
| 401 | var sect ionView; | |
| 402 | var gas; | |
| 403 | ||
| 404 | beforeEa ch(functio n() { | |
| 405 | var sectionReg ion; | |
| 406 | ||
| 407 | regi on = helpe rs.setupTe stingRegio n(); | |
| 408 | fetc h = helper s.collecti onFetchSpy (); | |
| 409 | mode l = create Model(); | |
| 410 | ||
| 411 | view = new Vie w({ | |
| 412 | model: mod el, | |
| 413 | typeOfCare Name: TYPE _OF_CARE, | |
| 414 | googleAnal yticsProvi der: { | |
| 415 | getIns tance: fun ction() { | |
| 416 | ga s = jasmin e.createSp yObj('gas' , ['gas']) ; | |
| 417 | re turn gas; | |
| 418 | }, | |
| 419 | }, | |
| 420 | }); | |
| 421 | prep areClinics Collection (view); | |
| 422 | view .collectio n.set(help ers.mockPa tientFacil ity(), {pa rse: true} ); | |
| 423 | regi on.show(vi ew); | |
| 424 | view .showRegio ns(); | |
| 425 | ||
| 426 | sect ionRegion = view.get Region('se ction'); | |
| 427 | sect ionView = sectionReg ion.curren tView; | |
| 428 | }); | |
| 429 | ||
| 430 | afterEac h(helpers. resetTesti ngRegion); | |
| 431 | ||
| 432 | it('upda tes its mo del on a c ollection change', f unction() { | |
| 433 | var isCalled = false; | |
| 434 | var id = 'myVa lue'; | |
| 435 | var value = vi ew.collect ion.first( ).get('ins titutionCo de'); | |
| 436 | ||
| 437 | view .listenTo( view.model , 'change: myValue', function() { | |
| 438 | isCalled = true; | |
| 439 | }); | |
| 440 | ||
| 441 | sect ionView.co llection.t rigger('ch ange:value ', new Bac kbone.Mode l({ | |
| 442 | id: id, | |
| 443 | value: val ue, | |
| 444 | })); | |
| 445 | ||
| 446 | expe ct(isCalle d).toBeTru thy(); | |
| 447 | expe ct(gas.gas ).toHaveBe enCalled() ; | |
| 448 | }); | |
| 449 | ||
| 450 | it('shou ld call Go ogle Analy tics when the collec tion chang es upon se lecting a facility', function( ) { | |
| 451 | var id = 'id'; | |
| 452 | var value = vi ew.collect ion.first( ).get('ins titutionCo de'); | |
| 453 | ||
| 454 | sect ionView.co llection.t rigger('ch ange:value ', new Bac kbone.Mode l({ | |
| 455 | id: id, | |
| 456 | value: val ue, | |
| 457 | })); | |
| 458 | ||
| 459 | expe ct(gas.gas ).toHaveBe enCalledWi th('send', 'event', 'veteran-a ppointment ', 'facili ty-selecte d', 'GREEN FIELD (CBO C) (GREENF IELD, MA)' ); | |
| 460 | }); | |
| 461 | }) ; | |
| 462 | }); | |
| 463 | ||
| 464 | descri be('Schedu ling Facil ity Sectio n View', f unction() { | |
| 465 | va r facility QuestionMo delSpy; | |
| 466 | ||
| 467 | va r setup = function(s ectionData In) { | |
| 468 | var faci litiesColl ectionMock ; | |
| 469 | var faci lityModelM ock; | |
| 470 | var view ; | |
| 471 | var goog leAnalytic sProviderM ock; | |
| 472 | facility QuestionMo delSpy = j asmine.cre ateSpyObj( 'facilityQ uestionMod elSpy', [' set']); | |
| 473 | ||
| 474 | faciliti esCollecti onMock = { | |
| 475 | toSe ctionData: function () { | |
| 476 | return sec tionDataIn ; | |
| 477 | }, | |
| 478 | }; | |
| 479 | facility ModelMock = { | |
| 480 | pacT eam: funct ion() { | |
| 481 | return {}; | |
| 482 | }, | |
| 483 | }; | |
| 484 | googleAn alyticsPro viderMock = { | |
| 485 | getI nstance: f unction() { | |
| 486 | return jas mine.creat eSpy('goog leAnalytic sMock', [' gas']); | |
| 487 | }, | |
| 488 | }; | |
| 489 | ||
| 490 | view = n ew Section View({ | |
| 491 | mode l: facilit yModelMock , | |
| 492 | pati entEnrolle dFacilitie s: facilit iesCollect ionMock, | |
| 493 | clin icsInstitu tionCodes: [], | |
| 494 | goog leAnalytic sProvider: googleAna lyticsProv iderMock, | |
| 495 | }); | |
| 496 | ||
| 497 | view.col lection = { | |
| 498 | get: function( property) { | |
| 499 | if (proper ty === 'fa cility') { | |
| 500 | return facilityQ uestionMod elSpy; | |
| 501 | } | |
| 502 | return nul l; | |
| 503 | }, | |
| 504 | }; | |
| 505 | ||
| 506 | return v iew; | |
| 507 | }; | |
| 508 | ||
| 509 | it ('should p ut the fac ilities wi th PAC Tea ms first i n the drop down', fun ction() { | |
| 510 | var faci lity1 = { 'text': 'f acility1', 'hasPactL abel': fal se }; | |
| 511 | var faci lity2 = { 'text': 'f acility2', 'hasPactL abel': fal se }; | |
| 512 | var faci lity3 = { 'text': 'f acility3', 'hasPactL abel': fal se }; | |
| 513 | var faci lity4 = { 'text': 'f acility4', 'hasPactL abel': tru e }; | |
| 514 | var faci lity5 = { 'text': 'f acility5', 'hasPactL abel': tru e }; | |
| 515 | ||
| 516 | var expe ctedOrder = [facilit y4, facili ty5, facil ity1, faci lity2, fac ility3]; | |
| 517 | var sect ionDataIn = [facilit y1, facili ty2, facil ity3, faci lity4, fac ility5]; | |
| 518 | var view = setup(s ectionData In); | |
| 519 | ||
| 520 | view.set FacilityQu estionMode l(); | |
| 521 | ||
| 522 | expect(f acilityQue stionModel Spy.set).t oHaveBeenC alledWith( 'values', expectedOr der); | |
| 523 | }) ; | |
| 524 | ||
| 525 | it ('should s ort the fa cilities a lphabetica lly', func tion() { | |
| 526 | var faci lityA = { 'text': 'a ', 'hasPac tLabel': f alse }; | |
| 527 | var faci lityB = { 'text': 'b ', 'hasPac tLabel': f alse }; | |
| 528 | var faci lityC = { 'text': 'c ', 'hasPac tLabel': f alse }; | |
| 529 | ||
| 530 | var expe ctedOrder = [facilit yA, facili tyB, facil ityC]; | |
| 531 | var sect ionDataIn = [facilit yA, facili tyC, facil ityB]; | |
| 532 | var view = setup(s ectionData In); | |
| 533 | ||
| 534 | view.set FacilityQu estionMode l(); | |
| 535 | ||
| 536 | expect(f acilityQue stionModel Spy.set).t oHaveBeenC alledWith( 'values', expectedOr der); | |
| 537 | }) ; | |
| 538 | ||
| 539 | }); | |
| 540 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.