300. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/10/2018 8:27:03 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.

300.1 Files compared

# Location File Last Modified
1 OSCIF MHED P3 Annie.zip\cms-staff-app-release-4.0.0@aff5ba84233.zip\MessagingApp\test\spec\modules\unsaved_changes unsaved_change_module_spec.js Thu Feb 22 10:28:51 2018 UTC
2 OSCIF MHED P3 Annie.zip\cms-staff-app-release-4.0.0@aff5ba84233.zip\MessagingApp\test\spec\modules\unsaved_changes unsaved_change_module_spec.js Wed May 9 13:07:50 2018 UTC

300.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 13 554
Changed 12 24
Inserted 0 0
Removed 0 0

300.3 Comparison options

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

300.4 Active regular expressions

No regular expressions were active.

300.5 Comparison detail

  1   'use stric t';
  2  
  3   describe(' Unsaved Ch ange Modul e', functi on() {
  4  
  5       var f DNS     plate,
  6       unsave dWarningsC onfig,
  7       unsave dWarningSh aredServic e,
  8       rootSc ope,
  9       scope,
  10         compiledF DNS     plate,
  11       isolat edControll erScope,
  12       httpBa ckend,
  13       window ,
  14       modal,
  15       q,
  16       locati on,
  17       templa teCache;
  18       var st affProfile ServiceMoc k = {
  19         quer y: functio n(){
  20           re turn {
  21              $promise:  {
  22                then: fu nction(){
  23  
  24                }
  25              }
  26           };
  27         }
  28       };
  29       var Pa tientsSumm aryService Mock = {
  30         getS ummary: fu nction(){
  31           re turn {
  32              $promise:  {
  33                then: fu nction(){
  34  
  35                }
  36              }
  37           };
  38         }
  39       };
  40  
  41  
  42     beforeEa ch(functio n () {
  43  
  44       module ('Messagin gAppApp');
  45       module ('unsavedC hanges');
  46  
  47       module (function  ($provide)  {
  48         $pro vide.value ('staffPro fileServic e', staffP rofileServ iceMock);
  49         $pro vide.value ('Patients SummarySer vice', Pat ientsSumma ryServiceM ock);
  50       });
  51  
  52       inject (function( $rootScope , $compile , $httpBac kend, $win dow, $uibM odal, $q,  $location,  $template Cache, _un savedWarni ngsConfig_ , _unsaved WarningSha redService _) {
  53         q =  $q;
  54         moda l = $uibMo dal;
  55         wind ow = $wind ow;
  56         loca tion = $lo cation;
  57         unsa vedWarning sConfig =  _unsavedWa rningsConf ig_;
  58         unsa vedWarning SharedServ ice = _uns avedWarnin gSharedSer vice_;
  59         temp lateCache  = $templat eCache;
  60         root Scope = $r ootScope;
  61  
  62         http Backend =  $httpBacke nd;
  63         http Backend.wh en('GET',  'views/emp tyPage.tpl .html').re spond(204) ;
  64  
  65         $tem plateCache .put('scri pts/module s/unsaved_ changes/un saved_chan ge_modal.t mpl.html',  '<div>fak emodal</di v>');
  66  
  67           f DNS     plate = an gular.elem ent(
  68           '< form name= "testForm"  unsaved-w arning-for m>' +
  69           '< input id=" test" requ ired name= "test" typ e="text" n g-model="t est"/>' +
  70           '< button id= "submit" t ype="submi t"></butto n>' +
  71           '< button id= "clear" ty pe="reset"  unsaved-w arning-cle ar>Clear</ button>' +
  72           '< button id= "trigger"  ng-click=" fakeClick( )" unsaved -warning-t rigger>Tri gger</butt on>' +
  73           '< /form>');
  74  
  75         scop e = $rootS cope.$new( );
  76           compiledF DNS     plate = $c ompile(f DNS     plate)(sco pe);
  77       });
  78  
  79       scope. $digest();
  80  
  81         isolatedCo ntrollerSc ope = comp iledF DNS     plate.isol ateScope() ;
  82  
  83       scope. testForm.$ setDirty() ;
  84  
  85       spyOn( scope.test Form, '$se tPristine' ).and.call Through();
  86       spyOn( scope, '$b roadcast') .and.callT hrough();
  87     });
  88  
  89     describe ('Directiv es', funct ion() {
  90       descri be('unsave d changes  form', fun ction() {
  91         it(' creates is olate scop e', functi on() {
  92             expect(com piledF DNS     plate.isol ateScope() .$parent). toEqual(sc ope);
  93         });
  94  
  95         it(' adds liste ner to onb eforeunloa d to detec t page rel oad', func tion() {
  96           ex pect(windo w.onbefore unload.toS tring()).t oContain(' allFormsCl ean()');
  97         });
  98  
  99         it(' adds liste ner $locat ionChangeS tart', fun ction() {
  100           ex pect(scope .$parent.$ $listeners .$location ChangeStar t.toString ()).toCont ain('!_thi s.allForms Clean()');
  101         });
  102  
  103         it(' removes li steners if  no more f orms exist ', functio n() {
  104           sc ope.$destr oy();
  105           sc ope.$diges t();
  106           ex pect(windo w.onbefore unload).to BeNull();
  107         });
  108       });
  109  
  110       descri be('unsave d warning  while chan ging locat ion', func tion() {
  111         befo reEach(fun ction() {
  112           va r deferred  = q.defer ();
  113           de ferred.res olve();
  114           sp yOn(modal,  'open').a nd.returnV alue({resu lt: deferr ed.promise });
  115           sp yOn(locati on, 'path' );
  116           sp yOn(unsave dWarningSh aredServic e, 'cleanA llForms'). and.callTh rough();
  117  
  118           lo cation.pat h('http:// localhost/ #newPath') ;
  119  
  120           sc ope.$apply ();
  121         });
  122  
  123         it(' should cle an forms a nd navigat e', functi on() {
  124           ex pect(unsav edWarningS haredServi ce.cleanAl lForms).to HaveBeenCa lled();
  125           ex pect(unsav edWarningS haredServi ce.allForm sClean()). toBe(true) ;
  126         });
  127       });
  128  
  129       descri be('unsave d warning  submit - i nvalid for m', functi on() {
  130         befo reEach(fun ction() {
  131           sc ope.testFo rm.$valid  = false;
  132             var submit  = f DNS     plate.find ('button') [0];
  133           su bmit.click ();
  134           sc ope.$apply ();
  135         });
  136  
  137         it(' should not  call $set Pristine()  on parent  form', fu nction() {
  138           ex pect(scope .testForm. $setPristi ne).not.to HaveBeenCa lled();
  139         });
  140       });
  141  
  142       descri be('unsave d warning  submit - v alid form' , function () {
  143         befo reEach(fun ction() {
  144           ht tpBackend. when('GET' , 'views/p atientSear ch.tpl.htm l').respon d(204);
  145           ht tpBackend. when('GET' , 'views/p atientSumm ary.tpl.ht ml').respo nd(204);
  146  
  147           sc ope.testFo rm.$valid  = true;
  148             var submit  = f DNS     plate.find ('button') [0];
  149           su bmit.click ();
  150           sc ope.$apply ();
  151         });
  152  
  153         it(' calls $set Pristine()  on parent  form when  clicked',  function( ) {
  154           ex pect(scope .testForm. $setPristi ne).toHave BeenCalled ();
  155         });
  156       });
  157  
  158       descri be('unsave d warning  clear', fu nction() {
  159         befo reEach(fun ction() {
  160           ht tpBackend. when('GET' , 'views/p atientSear ch.tpl.htm l').respon d(204);
  161           ht tpBackend. when('GET' , 'views/p atientSumm ary.tpl.ht ml').respo nd(204);
  162  
  163             var clear  = f DNS     plate.find ('button') [1];
  164           cl ear.click( );
  165           sc ope.$apply ();
  166         });
  167  
  168         it(' calls $set Pristine()  on parent  form when  clicked',  function( ) {
  169           ex pect(scope .testForm. $setPristi ne).toHave BeenCalled ();
  170         });
  171       });
  172  
  173       descri be('unsave d warning  trigger -  all forms  clean', fu nction() {
  174         befo reEach(fun ction() {
  175           va r detachWa tcher = ro otScope.$o n('$locati onChangeSt art', func tion (even t) {
  176              event.prev entDefault ();
  177              detachWatc her();
  178           }) ;
  179  
  180           sp yOn(modal,  'open');
  181           sp yOn(scope,  '$eval');
  182  
  183           un savedWarni ngSharedSe rvice.clea nAllForms( );
  184  
  185             var trigge r = f DNS     plate.find ('button') [2];
  186           tr igger.clic k();
  187  
  188           sc ope.$apply ();
  189         });
  190  
  191         it(' should jus t evaluate  the click  action',  function()  {
  192           ex pect(modal .open).not .toHaveBee nCalled();
  193           ex pect(scope .$eval).to HaveBeenCa lledWith(' fakeClick( )');
  194         });
  195       });
  196  
  197       descri be('unsave d warning  trigger -  staying on  page', fu nction() {
  198         befo reEach(fun ction() {
  199           va r deferred  = q.defer ();
  200           de ferred.rej ect();
  201           sp yOn(modal,  'open').a nd.returnV alue({resu lt: deferr ed.promise });
  202  
  203             var trigge r = f DNS     plate.find ('button') [2];
  204           tr igger.clic k();
  205  
  206           sc ope.$apply ();
  207         });
  208  
  209         it(' should ope n the moda l, but not  navigate  away after  it closes ', functio n() {
  210           ex pect(modal .open).toH aveBeenCal ledWith(un savedWarni ngsConfig. modalOptio ns);
  211           ex pect(unsav edWarningS haredServi ce.allForm sClean()). toBe(false );
  212         });
  213       });
  214  
  215       descri be('unsave d warning  trigger -  navigating  away', fu nction() {
  216         befo reEach(fun ction() {
  217  
  218           va r detachWa tcher = ro otScope.$o n('$locati onChangeSt art', func tion (even t) {
  219              event.prev entDefault ();
  220              detachWatc her();
  221           }) ;
  222  
  223           va r deferred  = q.defer ();
  224           de ferred.res olve();
  225           sp yOn(modal,  'open').a nd.returnV alue({resu lt: deferr ed.promise });
  226           sp yOn(scope,  '$eval');
  227  
  228             var trigge r = f DNS     plate.find ('button') [2];
  229           tr igger.clic k();
  230  
  231  
  232           sc ope.$apply ();
  233         });
  234  
  235         it(' should ope n the moda l, then ex ecute the  default cl ick action  after it  closes', f unction()  {
  236           ex pect(modal .open).toH aveBeenCal ledWith(un savedWarni ngsConfig. modalOptio ns);
  237           ex pect(unsav edWarningS haredServi ce.allForm sClean()). toBe(true) ;
  238           ex pect(scope .$eval).to HaveBeenCa lledWith(' fakeClick( )');
  239         });
  240       });
  241     });
  242  
  243     describe ('Configur ation', fu nction() {
  244       it('ha s a reload  message',  function( ) {
  245         expe ct(unsaved WarningsCo nfig.reloa dMessage). toEqual('Y ou have no t saved yo ur changes . You may  continue w ithout sav ing or ret urn to the  entry scr een.');
  246       });
  247  
  248       it('ha s route ev ents', fun ction() {
  249         expe ct(unsaved WarningsCo nfig.route Events).to Equal(['$l ocationCha ngeStart'] );
  250       });
  251  
  252       it('ha s modal op tions', fu nction() {
  253         expe ct(unsaved WarningsCo nfig.modal Options).t oEqual({
  254           te mplateUrl:  'scripts/ modules/un saved_chan ges/unsave d_change_m odal.tmpl. html',
  255           ba ckdrop: 's tatic',
  256           co ntroller:  'unsavedWa rningModal Controller '
  257         });
  258       });
  259     });
  260  
  261     describe ('Modal Co ntroller',  function  () {
  262       var un savedWarni ngModalCon troller,
  263         moda lScope,
  264         moda lInstanceM ock = {
  265           cl ose: jasmi ne.createS py('closeS py'),
  266           di smiss: jas mine.creat eSpy('dism issSpy')
  267         };
  268  
  269       before Each(funct ion() {
  270         inje ct(functio n ($contro ller, $roo tScope) {
  271           mo dalScope =  $rootScop e.$new();
  272           un savedWarni ngModalCon troller =  $controlle r('unsaved WarningMod alControll er', {
  273              $scope: mo dalScope,
  274              $uibModalI nstance: m odalInstan ceMock
  275           }) ;
  276         });
  277       });
  278  
  279       it ('d ismiss the  modal whe n return i s called',  function  () {
  280         moda lScope.ret urn();
  281         expe ct(modalIn stanceMock .dismiss). toHaveBeen Called();
  282       });
  283  
  284       it ('c lose the m odal when  continue i s called',  function  () {
  285         moda lScope.con tinue();
  286         expe ct(modalIn stanceMock .close).to HaveBeenCa lled();
  287       });
  288     });
  289   });