10. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/26/2019 10:01:15 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.

10.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\CCCC\CCCC\seoc-ui1.8\cc_seoc_ui\src\components\user-management UserTable.spec.js Tue Apr 9 17:46:26 2019 UTC
2 C:\AraxisMergeCompare\Pri_re\CCCC\CCCC\seoc-ui1.8\cc_seoc_ui\src\components\user-management UserTable.spec.js Wed Apr 24 20:05:49 2019 UTC

10.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 7 1192
Changed 6 24
Inserted 0 0
Removed 0 0

10.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

10.4 Active regular expressions

No regular expressions were active.

10.5 Comparison detail

  1   import Rea ct from 'r eact';
  2   import { s hallow } f rom 'enzym e';
  3  
  4   import { r oleFilterT ypes } fro m '../../c onstants/f ilterTypes ';
  5  
  6   import Use rTable fro m './UserT able';
  7   import Use rTableHead er from '. /UserTable Header';
  8   import Use rTableRow  from './Us erTableRow ';
  9   import Use rTableForm Row from ' ./UserTabl eFormRow';
  10  
  11   const gene rateUsers  = () => {
  12     let gene ratedUsers  = [];
  13  
  14     for (let  i = 0; i  < 60; i +=  1) {
  15       const  role = rol eFilterTyp es[i % 4];
  16  
  17       let us er = {
  18         id:  `${i + 1}` ,
  19         user Name: `Use r, ${role}  ${i + 1}` ,
  20         role : role,
  21         vaNe tworkId: ' SEOC${role }User',
  22         doma in: 'DEV'
  23       };
  24  
  25       genera tedUsers.p ush(user);
  26     }
  27  
  28     return g eneratedUs ers;
  29   };
  30  
  31   const user s = genera teUsers();
  32  
  33   let showEd it;
  34   let usersL ist = user s;
  35   let update User;
  36   let user =  {
  37       id: ' AI ',
  38       userName:  '
A I ',
  39     role: 'A dministrat or',
  40       vaNetworkI d: '
A I ',
  41       domain: '
E XT '
  42   };
  43   let select ed = null;
  44  
  45   let focus;
  46  
  47   describe(' UserTable  Component' , () => {
  48     let wrap per;
  49     let tabl e;
  50  
  51     let upda teSelected ;
  52  
  53     const mo untWrapper  = () => {
  54       wrappe r = shallo w(
  55         <Use rTable
  56           sh owEdit={sh owEdit}
  57           us ers={users List}
  58           up dateUser={ updateUser }
  59           us er={user}
  60           up dateSelect ed={update Selected}
  61           se lected={se lected} /> );
  62       table  = wrapper. instance() ;
  63     };
  64  
  65     beforeEa ch(() => {
  66       showEd it = false ;
  67       update User = jes t.fn();
  68       update Selected =  jest.fn() ;
  69       focus  = jest.fn( );
  70  
  71       docume nt.querySe lector = j est.fn().m ockImpleme ntation(()  => ({ foc us }));
  72  
  73       mountW rapper();
  74     });
  75  
  76     describe ('elements ', () => {
  77       it('sh ould use a  UserTable Header', ( ) => {
  78         cons t actual =  wrapper.f ind(UserTa bleHeader) .length;
  79         cons t expected  = 1;
  80  
  81         expe ct(actual) .toEqual(e xpected);
  82       });
  83  
  84       it('sh ould pass  props to t he UserTab leHeader',  () => {
  85         cons t actual =  wrapper.f ind(UserTa bleHeader) .prop('pro ps');
  86         cons t expected  = { showE dit: false  };
  87  
  88         expe ct(actual) .toEqual(e xpected);
  89       });
  90  
  91       descri be('showEd it is fals e', () =>  {
  92         befo reEach(()  => {
  93           sh owEdit = f alse;
  94         });
  95  
  96         it(' should dis play one U serTableRo w for each  User', ()  => {
  97           us ersList =  users;
  98           mo untWrapper ();
  99     
  100           co nst userTa bleRows =  wrapper.fi nd(UserTab leRow);
  101     
  102           ex pect(userT ableRows.l ength).toE qual(60);
  103     
  104           us erTableRow s.forEach( (userTable Row, index ) => {
  105              updateSele cted.mockR eset();
  106             
  107              expect(use rTableRow. key()).toE qual(`${us ers[index] .id}`);
  108              expect(use rTableRow. prop('user ')).toEqua l(users[in dex]);
  109              expect(use rTableRow. prop('sele cted')).to Equal(tabl e.state.se lected ===  index);
  110              expect(use rTableRow. prop('rowI ndex')).to Equal(inde x);
  111              expect(use rTableRow. prop('show Edit')).to Equal(show Edit);
  112     
  113              userTableR ow.prop('u pdateSelec ted')();
  114  
  115              expect(upd ateSelecte d).toBeCal led();
  116           }) ;
  117         });
  118  
  119         it(' should dis play all o f the user s, even if  the user  prop match es one of  the users' , () => {
  120           us ersList =  users;
  121           us er = users [59];
  122           mo untWrapper ();
  123  
  124           co nst userTa bleRows =  wrapper.fi nd(UserTab leRow);
  125     
  126           ex pect(userT ableRows.l ength).toE qual(60);
  127     
  128           us erTableRow s.forEach( (userTable Row, index ) => {
  129              expect(use rTableRow. key()).toE qual(`${us ers[index] .id}`);
  130              expect(use rTableRow. prop('user ')).toEqua l(users[in dex]);
  131              expect(use rTableRow. prop('sele cted')).to Equal(tabl e.state.se lected ===  index);
  132              expect(use rTableRow. prop('rowI ndex')).to Equal(inde x);
  133              expect(use rTableRow. prop('show Edit')).to Equal(show Edit);
  134           }) ;
  135         });
  136       });
  137  
  138       descri be('showEd it is true ', () => {
  139         befo reEach(()  => {
  140           sh owEdit = t rue;
  141         });
  142  
  143         it(' should dis play one U serTableFo rm Row, an d one User TableRow f or each Us er', () =>  {
  144           us ersList =  users;
  145           us er = {
  146               id:  AI ,
  147               userName:  '
A I ',
  148              role: 'Adm inistrator ',
  149               vaNetworkI d: '
A I ',
  150               domain: '
E XT '
  151           };
  152           mo untWrapper ();
  153  
  154           co nst userTa bleFormRow  = wrapper .find(User TableFormR ow);
  155           co nst userTa bleRows =  wrapper.fi nd(UserTab leRow);
  156  
  157           ex pect(userT ableFormRo w.length). toEqual(1) ;
  158           ex pect(userT ableFormRo w.key()).t oEqual('0' );
  159           ex pect(userT ableFormRo w.prop('us er')).toEq ual(user);
  160  
  161           up dateUser.m ockReset() ;
  162           us erTableFor mRow.prop( 'updateUse r')();
  163  
  164           ex pect(updat eUser).toB eCalled();
  165  
  166           ex pect(userT ableRows.l ength).toE qual(60);
  167     
  168           us erTableRow s.forEach( (userTable Row, index ) => {
  169              updateSele cted.mockR eset();
  170             
  171              expect(use rTableRow. key()).toE qual(`${in dex + 1}`) ;
  172              expect(use rTableRow. prop('user ')).toEqua l(users[in dex]);
  173              expect(use rTableRow. prop('sele cted')).to Equal(tabl e.state.se lected ===  index);
  174              expect(use rTableRow. prop('rowI ndex')).to Equal(inde x);
  175              expect(use rTableRow. prop('show Edit')).to Equal(show Edit);
  176     
  177              userTableR ow.prop('u pdateSelec ted')();
  178  
  179              expect(upd ateSelecte d).toBeCal led();
  180           }) ;
  181         });
  182  
  183         it(' should not  display a  row that  matches th e current  user prop' , () => {
  184           us ersList =  users;
  185           us er = users [59];
  186           mo untWrapper ();
  187  
  188           co nst userTa bleRows =  wrapper.fi nd(UserTab leRow);
  189  
  190           ex pect(userT ableRows.l ength).toE qual(59);
  191  
  192           us erTableRow s.forEach( (userTable Row) => {
  193              expect(use rTableRow. prop('user ')).not.to Equal(user );
  194           }) ;
  195         });
  196       });
  197     });
  198  
  199     describe ('componen tDidUpdate ', () => {
  200       before Each(() =>  {
  201         user sList = us ers;
  202  
  203         tabl e.updateSe lected = j est.fn();
  204         
  205         wrap per.setPro ps({ users : usersLis t });
  206  
  207         tabl e.updateSe lected.moc kReset();
  208       });
  209  
  210       it('sh ould not c all update Selected i f the user s prop is  has not ch anged', ()  => {
  211         user sList = us ers;
  212         
  213         wrap per.setPro ps({ users : usersLis t });
  214  
  215         expe ct(table.u pdateSelec ted).not.t oBeCalled( );
  216       });
  217  
  218       it('sh ould call  updateSele cted if th e users pr op has cha nged', ()  => {
  219         user sList = [{
  220             id:  AI ,
  221             userName:  '
A I ',
  222           ro le: 'Admin istrator',
  223             vaNetworkI d: '
A I ',
  224             domain: '
E XT '
  225         }];
  226  
  227         wrap per.setPro ps({ users : usersLis t });
  228  
  229         expe ct(table.u pdateSelec ted).toBeC alled();
  230       });
  231     });
  232  
  233     describe ('updateSe lected', ( ) => {
  234       before Each(() =>  {
  235         user sList = us ers;
  236         moun tWrapper() ;
  237       });
  238  
  239       it('sh ould defau lt selecte d to 0', ( ) => {
  240         cons t actual =  table.sta te.selecte d;
  241         cons t expected  = 0;
  242  
  243         expe ct(actual) .toEqual(e xpected);
  244       });
  245  
  246       it('sh ould updat e selected ', () => {
  247         cons t newIndex  = 2;
  248  
  249         tabl e.updateSe lected(new Index);
  250  
  251         cons t actual =  table.sta te.selecte d;
  252         cons t expected  = newInde x;
  253  
  254         expe ct(actual) .toEqual(e xpected);
  255       });
  256  
  257       it('sh ould call  the given  function a fter updat ing select ed', () =>  {
  258         cons t newIndex  = 2;
  259         cons t afterUpd ate = jest .fn();
  260  
  261         tabl e.updateSe lected(new Index, aft erUpdate);
  262  
  263         expe ct(afterUp date).toBe Called();
  264       });
  265  
  266       it('sh ould call  the update Selected p rop with t he id of t he selecte d SEOC', ( ) => {
  267         cons t newIndex  = 2;
  268  
  269         tabl e.updateSe lected(new Index);
  270  
  271         expe ct(updateS elected).t oBeCalledW ith(users[ newIndex]. id);
  272       });
  273     });
  274  
  275     describe ('focusSel ected', ()  => {
  276       it('sh ould focus  on the se lected row ', () => {
  277         let  focus = je st.fn();
  278         let  scrollInto View = jes t.fn();
  279  
  280         docu ment.query Selector =  jest.fn() .mockImple mentation( () => ({
  281           fo cus,
  282           sc rollIntoVi ew
  283         }));
  284  
  285         tabl e.setState ({ selecte d: 2 });
  286  
  287         tabl e.focusSel ected();
  288  
  289         expe ct(documen t.querySel ector).toB eCalledWit h('table.s eoc-table  tbody tr:n th-child(3 )');
  290         expe ct(focus). toBeCalled ();
  291       });
  292  
  293       it('sh ould call  scrollInto View, when  focusing  on the sel ected row' , () => {
  294         let  focus = je st.fn();
  295         let  scrollInto View = jes t.fn();
  296  
  297         docu ment.query Selector =  jest.fn() .mockImple mentation( () => ({
  298           fo cus,
  299           sc rollIntoVi ew
  300         }));
  301  
  302         tabl e.setState ({ selecte d: 2 });
  303  
  304         tabl e.focusSel ected();
  305  
  306         expe ct(scrollI ntoView).t oBeCalledW ith(true);
  307       });
  308     });
  309  
  310     describe ('key down  events',  () => {
  311       let pr eventDefau lt;
  312  
  313       descri be('showEd it is fals e', () =>  {
  314         befo reEach(()  => {
  315           sh owEdit = f alse;
  316           mo untWrapper ();
  317  
  318           ta ble.update Selected =  jest.fn() ;
  319           ta ble.focusS elected =  jest.fn();
  320           pr eventDefau lt = jest. fn();
  321         });
  322  
  323         desc ribe('arro w up', ()  => {
  324           it ('should m ove select ed to the  previous r ow if sele cted is no t the firs t row', ()  => {
  325              const curr Selected =  2;
  326  
  327              table.setS tate({ sel ected: cur rSelected  });
  328  
  329              table.hand leKeyDown( {
  330                which: 3 8,
  331                preventD efault
  332              });
  333  
  334              expect(tab le.updateS elected).t oBeCalled( );
  335  
  336              const para ms = table .updateSel ected.mock .calls[0];
  337  
  338              expect(par ams[0]).to Equal(curr Selected -  1);
  339  
  340              params[1]( );
  341              expect(tab le.focusSe lected).to BeCalled() ;
  342           }) ;
  343  
  344           it ('should n ot move to  the previ ous row if  selected  is the fir st row', ( ) => {
  345              const curr Selected =  0;
  346  
  347              table.setS tate({ sel ected: cur rSelected  });
  348  
  349              table.hand leKeyDown( {
  350                which: 3 8,
  351                preventD efault
  352              });
  353  
  354              expect(tab le.updateS elected).n ot.toBeCal led();
  355              expect(tab le.focusSe lected).no t.toBeCall ed();
  356           }) ;
  357         });
  358  
  359         desc ribe('arro w down', ( ) => {
  360           it ('should m ove select ed to the  next row i f selected  is not th e last row ', () => {
  361              const curr Selected =  0;
  362  
  363              table.setS tate({ sel ected: cur rSelected  });
  364  
  365              table.hand leKeyDown( {
  366                which: 4 0,
  367                preventD efault
  368              });
  369  
  370              expect(tab le.updateS elected).t oBeCalled( );
  371  
  372              const para ms = table .updateSel ected.mock .calls[0];
  373  
  374              expect(par ams[0]).to Equal(curr Selected +  1);
  375  
  376              params[1]( );
  377              expect(tab le.focusSe lected).to BeCalled() ;
  378           }) ;
  379  
  380           it ('should n ot move to  the next  row if sel ected is t he last ro w', () =>  {
  381              const curr Selected =  wrapper.f ind(UserTa bleRow).le ngth - 1;
  382  
  383              table.setS tate({ sel ected: cur rSelected  });
  384  
  385              table.hand leKeyDown( {
  386                which: 4 0,
  387                preventD efault
  388              });
  389  
  390              const actu al = table .state.sel ected;
  391              const expe cted = cur rSelected;
  392  
  393              expect(act ual).toEqu al(expecte d);
  394  
  395              expect(tab le.updateS elected).n ot.toBeCal led();
  396              expect(tab le.focusSe lected).no t.toBeCall ed();
  397           }) ;
  398         });
  399  
  400         desc ribe('page  up', () = > {
  401           it ('should c all preven tDefault,  when pagin g up', ()  => {
  402              const curr Selected =  12;
  403  
  404              table.setS tate({ sel ected: cur rSelected  });
  405  
  406              table.hand leKeyDown( {
  407                which: 3 3,
  408                preventD efault
  409              });
  410  
  411              expect(pre ventDefaul t).toBeCal led();
  412           }) ;
  413  
  414           it ('should m ove select ed up to t he row spe cified by  the offset ', () => {
  415              const curr Selected =  12;
  416  
  417              table.setS tate({ sel ected: cur rSelected  });
  418  
  419              table.hand leKeyDown( {
  420                which: 3 3,
  421                preventD efault
  422              });
  423  
  424              expect(tab le.updateS elected).t oBeCalled( );
  425  
  426              const para ms = table .updateSel ected.mock .calls[0];
  427  
  428              expect(par ams[0]).to Equal(2);
  429  
  430              params[1]( );
  431              expect(tab le.focusSe lected).to BeCalled() ;
  432           }) ;
  433  
  434           it ('should m ove select ed up to t he first r ow if the  index of t he selecte d row is l ess than t he offset' , () => {
  435              const curr Selected =  5;
  436  
  437              table.setS tate({ sel ected: cur rSelected  });
  438  
  439              table.hand leKeyDown( {
  440                which: 3 3,
  441                preventD efault
  442              });
  443  
  444              expect(tab le.updateS elected).t oBeCalled( );
  445  
  446              const para ms = table .updateSel ected.mock .calls[0];
  447  
  448              expect(par ams[0]).to Equal(0);
  449  
  450              params[1]( );
  451              expect(tab le.focusSe lected).to BeCalled() ;
  452           }) ;
  453  
  454           it ('should n ot move to  the previ ous row, i f the sele cted row i s the firs t row', ()  => {
  455              const curr Selected =  0;
  456  
  457              table.setS tate({ sel ected: cur rSelected  });
  458  
  459              table.hand leKeyDown( {
  460                which: 3 3,
  461                preventD efault
  462              });
  463  
  464              expect(tab le.updateS elected).t oBeCalled( );
  465  
  466              const para ms = table .updateSel ected.mock .calls[0];
  467  
  468              expect(par ams[0]).to Equal(0);
  469  
  470              params[1]( );
  471              expect(tab le.focusSe lected).to BeCalled() ;
  472           }) ;
  473         });
  474  
  475         desc ribe('page  down', ()  => {
  476           it ('should c all preven tDefault,  when pagin g down', ( ) => {
  477              const curr Selected =  0;
  478  
  479              table.setS tate({ sel ected: cur rSelected  });
  480  
  481              table.hand leKeyDown( {
  482                which: 3 4,
  483                preventD efault
  484              });
  485  
  486              expect(pre ventDefaul t).toBeCal led();
  487           }) ;
  488  
  489           it ('should m ove select ed down to  the row s pecified b y the offs et', () =>  {
  490              const curr Selected =  0;
  491  
  492              table.setS tate({ sel ected: cur rSelected  });
  493  
  494              table.hand leKeyDown( {
  495                which: 3 4,
  496                preventD efault
  497              });
  498  
  499              expect(tab le.updateS elected).t oBeCalled( );
  500  
  501              const para ms = table .updateSel ected.mock .calls[0];
  502  
  503              expect(par ams[0]).to Equal(tabl e.state.of fset);
  504  
  505              params[1]( );
  506              expect(tab le.focusSe lected).to BeCalled() ;
  507           }) ;
  508  
  509           it ('should m ove select ed down to  the last  row if the  number of  rows rema ining is l ess than t he offset' , () => {
  510              const curr Selected =  55;
  511  
  512              table.setS tate({ sel ected: cur rSelected  });
  513  
  514              table.hand leKeyDown( {
  515                which: 3 4,
  516                preventD efault
  517              });
  518  
  519              expect(tab le.updateS elected).t oBeCalled( );
  520  
  521              const para ms = table .updateSel ected.mock .calls[0];
  522  
  523              expect(par ams[0]).to Equal(59);
  524  
  525              params[1]( );
  526              expect(tab le.focusSe lected).to BeCalled() ;
  527           }) ;
  528  
  529           it ('should n ot move to  the next  row, if th e selected  row is th e last row ', () => {
  530              const curr Selected =  59;
  531  
  532              table.setS tate({ sel ected: cur rSelected  });
  533  
  534              table.hand leKeyDown( {
  535                which: 3 4,
  536                preventD efault
  537              });
  538  
  539              expect(tab le.updateS elected).t oBeCalled( );
  540  
  541              const para ms = table .updateSel ected.mock .calls[0];
  542  
  543              expect(par ams[0]).to Equal(59);
  544  
  545              params[1]( );
  546              expect(tab le.focusSe lected).to BeCalled() ;
  547           }) ;
  548         });
  549       });
  550  
  551       descri be('showEd it is true ', () => {
  552         befo reEach(()  => {
  553           sh owEdit = t rue;
  554           mo untWrapper ();
  555  
  556           ta ble.update Selected =  jest.fn() ;
  557           ta ble.focusS elected =  jest.fn();
  558           ta ble.handle PageUpFocu s = jest.f n();
  559           ta ble.handle PageDownFo cus = jest .fn();
  560           pr eventDefau lt = jest. fn();
  561  
  562           ta ble.setSta te({ selec ted: 2 });
  563         });
  564  
  565         it(' should not  call the  arrow up e vent', ()  => {
  566           ta ble.handle KeyDown({
  567              which: 38,
  568              preventDef ault
  569           }) ;
  570  
  571           ex pect(preve ntDefault) .not.toBeC alled();
  572           ex pect(table .updateSel ected).not .toBeCalle d();
  573           ex pect(table .focusSele cted).not. toBeCalled ();
  574         });
  575  
  576         it(' should not  call the  arrow down  event', ( ) => {
  577           ta ble.handle KeyDown({
  578              which: 40,
  579              preventDef ault
  580           }) ;
  581  
  582           ex pect(preve ntDefault) .not.toBeC alled();
  583           ex pect(table .updateSel ected).not .toBeCalle d();
  584           ex pect(table .focusSele cted).not. toBeCalled ();
  585         });
  586  
  587         it(' should not  call the  page up ev ent', () = > {
  588           ta ble.handle KeyDown({
  589              which: 33,
  590              preventDef ault
  591           }) ;
  592  
  593           ex pect(preve ntDefault) .not.toBeC alled();
  594           ex pect(table .handlePag eUpFocus). not.toBeCa lled();
  595         });
  596  
  597         it(' should not  call the  page up ev ent', () = > {
  598           ta ble.handle KeyDown({
  599              which: 34,
  600              preventDef ault
  601           }) ;
  602  
  603           ex pect(preve ntDefault) .not.toBeC alled();
  604           ex pect(table .handlePag eDownFocus ).not.toBe Called();
  605         });
  606       });
  607     });
  608   });