Produced by Araxis Merge on 12/7/2018 11:36:02 AM Central Standard 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:\SCRUB\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\modules\form\input | datepicker-question-view_spec.js | Mon Oct 22 23:25:20 2018 UTC |
| 2 | C:\MHED-scrubbed\MHED\MHED\VAR 4.10.0\var-web-release-4.10@e10f18de1ef\veteran-appointment-requests\app\modules\form\input | datepicker-question-view_spec.js | Fri Dec 7 13:07:24 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 316 |
| Changed | 2 | 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 | define([ | |
| 2 | 'Layou t', | |
| 3 | 'modul es/form/qu estion-vie w', | |
| 4 | 'modul es/form/qu estion-mod el', | |
| 5 | 'momen t', | |
| 6 | ], | |
| 7 | function(L ayout, Que stionView, QuestionM odel, mome nt) { | |
| 8 | 'use s trict'; | |
| 9 | ||
| 10 | descri be('Datepi cker Quest ion View', function( ) { | |
| 11 | va r modelJSO N; | |
| 12 | va r view; | |
| 13 | va r $view; | |
| 14 | va r layout; | |
| 15 | ||
| 16 | ||
| 17 | fu nction fac tory() { | |
| 18 | return { | |
| 19 | 'id' : 'unit-te st-datepic ker', | |
| 20 | 'typ e': 'text- datepicker ', | |
| 21 | 'lab el': 'Unit Test Date picker', | |
| 22 | 'req uired': fa lse, | |
| 23 | 'idP refix': '' , | |
| 24 | 'val ue': '', | |
| 25 | 'val idate': { | |
| 26 | 'rules': { | |
| 27 | 'forma ttedDate': true, | |
| 28 | 'dateI nRange': t rue, | |
| 29 | }, | |
| 30 | }, | |
| 31 | }; | |
| 32 | } | |
| 33 | ||
| 34 | ||
| 35 | fu nction _ut cToLocal(u tc) { | |
| 36 | return u tc && new Date(utc.g etTime() + (utc.getT imezoneOff set() * 60 000)); | |
| 37 | } | |
| 38 | ||
| 39 | ||
| 40 | be foreEach(f unction() { | |
| 41 | modelJSO N = factor y(); | |
| 42 | layout = new Layou t(); | |
| 43 | layout.r ender(); | |
| 44 | }) ; | |
| 45 | ||
| 46 | ||
| 47 | // TODO: upg rade Jasmi ne, change to before All | |
| 48 | de scribe('wi th bootstr ap-datepic ker defaul ts', funct ion() { | |
| 49 | beforeEa ch(functio n() { | |
| 50 | ||
| 51 | view = new Que stionView( {model: ne w Question Model(mode lJSON)}); | |
| 52 | ||
| 53 | spyO n(view, 'i nitializeD atepicker' ).and.call Through(); | |
| 54 | spyO n(view, 'c reateDatep icker').an d.callThro ugh(); | |
| 55 | spyO n(view, 'a ddFormVali dationRule s'); | |
| 56 | spyO n(view, 'u pdateDayOf WeekSpan') .and.callT hrough(); | |
| 57 | spyO n(view, 'm askInput') .and.callT hrough(); | |
| 58 | ||
| 59 | layout.sho wChildView ('f DNS tent', vie w); | |
| 60 | $vie w = view.$ el; | |
| 61 | }); | |
| 62 | ||
| 63 | it('show s a calend ar picker control on click of button', f unction() { | |
| 64 | $vie w.find('bu tton').cli ck(); | |
| 65 | expe ct($('.dat epicker:vi sible').le ngth).toBe (1); | |
| 66 | }); | |
| 67 | ||
| 68 | it('has a default range from 1/1/1900 to 12/31/2 099', func tion() { | |
| 69 | // r everse _lo cal_to_utc in datepi cker | |
| 70 | expe ct(moment( _utcToLoca l($view.fi nd('button ').datepic ker('getSt artDate')) ).format(' MM/DD/YYYY ')).toEqua l('01/01/1 900'); | |
| 71 | expe ct(moment( _utcToLoca l($view.fi nd('button ').datepic ker('getEn dDate'))). format('MM /DD/YYYY') ).toEqual( '12/30/209 9'); | |
| 72 | }); | |
| 73 | ||
| 74 | it('upda tes calend ar when te xt is ente red', func tion() { | |
| 75 | $vie w.find('in put[type=" text"]').v al('01/06/ 2016') | |
| 76 | .trigger(' keyup'); | |
| 77 | expe ct($view.f ind('butto n').datepi cker('getD ate')).toE qual(new D ate('01/06 /2016')); | |
| 78 | }); | |
| 79 | ||
| 80 | it('upda tes text w hen calend ar date is selected' , function () { | |
| 81 | $vie w.find('bu tton').dat epicker('s etDate', ' 01/12/2017 '); | |
| 82 | expe ct($view.f ind('input [type="tex t"]').val( )).toEqual ('01/12/20 17'); | |
| 83 | }); | |
| 84 | ||
| 85 | it('dese lects cale ndar date when text is empty', function( ) { | |
| 86 | $vie w.find('in put[type=" text"]').v al('01/06/ 2016'); | |
| 87 | $vie w.find('in put[type=" text"]').v al(''); | |
| 88 | expe ct($view.f ind('butto n').datepi cker('getD ate')).toE qual(null) ; | |
| 89 | }); | |
| 90 | ||
| 91 | it('upda tes the da y of the w eek when t ext is ent ered', fun ction() { | |
| 92 | $vie w.find('in put[type=" text"]').v al('01/06/ 2016') | |
| 93 | .trigger(' keyup'); | |
| 94 | expe ct($($view .find('.fo rm-input-d atepicker- day .ui-hi dden-acces sible')).t ext()).toE qual('Day selected i s Wednesda y'); | |
| 95 | expe ct($($view .find('.fo rm-input-d atepicker- day [role= "presentat ion"]')).t ext()).toE qual('Wedn esday'); | |
| 96 | }); | |
| 97 | ||
| 98 | it('upda tes the da y of the w eek when c alendar da te is sele cted', fun ction() { | |
| 99 | $vie w.find('bu tton').cli ck(); | |
| 100 | $vie w.find('bu tton').dat epicker('s etDate', ' 01/12/2017 '); | |
| 101 | expe ct($($view .find('.fo rm-input-d atepicker- day .ui-hi dden-acces sible')).t ext()).toE qual('Day selected i s Thursday '); | |
| 102 | expe ct($($view .find('.fo rm-input-d atepicker- day [role= "presentat ion"]')).t ext()).toE qual('Thur sday'); | |
| 103 | }); | |
| 104 | ||
| 105 | it('has a label fo r screen r eaders on the calend ar button' , function () { | |
| 106 | expe ct($view.f ind('butto n').attr(' aria-label ')).toEqua l('This ca lendar con trol is no t optimize d for scre en readers . Please d irectly en ter dates in the tex t box prov ided. Open calendar control.') ; | |
| 107 | }); | |
| 108 | ||
| 109 | // TODO these shou ld be dele ted | |
| 110 | // it('s hows an er ror messag e when an invalid da te is ente red', func tion(){ | |
| 111 | // $vie w.find('#u nit-test-d atepicker' ).val('666 ').trigger ('keyup'); | |
| 112 | // expe ct($($view .find('.va lidation-e rror')).te xt()).toEq ual("Pleas e enter a valid Date ."); | |
| 113 | // }); | |
| 114 | ||
| 115 | // it('s hows an er ror messag e when dat e is not w ithin min/ max range' , function (){ | |
| 116 | // $vie w.find('#u nit-test-d atepicker' ).val('01/ 07/2017'). trigger('k eyup'); | |
| 117 | // expe ct($($view .find('.va lidation-e rror')).te xt()).toEq ual("Pleas e enter a date betwe en {0} and {1}."); | |
| 118 | // }); | |
| 119 | }) ; | |
| 120 | ||
| 121 | de scribe('wi th bootstr ap-datepic ker defaul ts and dat eAndTimeFo rmatted va lidation', function( ) { | |
| 122 | modelJSO N = { | |
| 123 | 'id' : 'unit-te st-datepic ker', | |
| 124 | 'typ e': 'text- datepicker ', | |
| 125 | 'lab el': 'Unit Test Date picker', | |
| 126 | 'req uired': fa lse, | |
| 127 | 'idP refix': '' , | |
| 128 | 'val ue': '', | |
| 129 | 'val idate': { | |
| 130 | 'rules': { | |
| 131 | 'forma ttedDate': true, | |
| 132 | 'dateI nRange': t rue, | |
| 133 | }, | |
| 134 | }, | |
| 135 | }; | |
| 136 | ||
| 137 | beforeEa ch(functio n() { | |
| 138 | view = new Que stionView( {model: ne w Question Model(mode lJSON)}); | |
| 139 | ||
| 140 | spyO n(view, 'a ddFormVali dationRule s'); | |
| 141 | spyO n(view, 'c reateDatep icker').an d.callThro ugh(); | |
| 142 | spyO n(view, 'o nShow').an d.callThro ugh(); | |
| 143 | spyO n(view, 'i nitializeD atepicker' ).and.call Through(); | |
| 144 | ||
| 145 | spyO n(view, 'u pdateDayOf WeekSpan') .and.callT hrough(); | |
| 146 | spyO n(view, 'm askInput') .and.callT hrough(); | |
| 147 | ||
| 148 | layout.sho wChildView ('f DNS tent', vie w); | |
| 149 | $vie w = view.$ el; | |
| 150 | }); | |
| 151 | ||
| 152 | // it('s hows an er ror messag e when dat e and time are not v alid', fun ction(){ | |
| 153 | // $vie w.find('#u nit-test-d atepicker' ).val('777 ').trigger ('keyup'); | |
| 154 | // expe ct($view.f ind('.vali dation-err or').text( )).toEqual ("Please e nter a val id Date an d Time."); | |
| 155 | // }); | |
| 156 | ||
| 157 | }) ; | |
| 158 | }); | |
| 159 | ||
| 160 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.