11/* eslint-env mocha */ 
2+ import  'should' ; 
23import  sinon  from  'sinon' ; 
3- import  expect  from  'expect' ; 
44import  React  from  'react' ; 
55import  ReactDOM  from  'react-dom' ; 
66import  TestUtils  from  'react-dom/test-utils' ; 
7- import  Modal  from  '../src/components/Modal' ; 
7+ import  Modal  from  '../src/components/Modal.js ' ; 
88import  { 
99  moverlay ,  mcontent , 
1010  clickAt ,  mouseDownAt ,  mouseUpAt ,  escKeyDown ,  tabKeyDown , 
1111  renderModal ,  emptyDOM 
1212}  from  './helper' ; 
1313
14- describe ( 'Events' ,  ( )  =>  { 
14+ export   default  ( )  =>  { 
1515  afterEach ( 'Unmount modal' ,  emptyDOM ) ; 
1616
1717  it ( 'should trigger the onAfterOpen callback' ,  ( )  =>  { 
1818    const  afterOpenCallback  =  sinon . spy ( ) ; 
1919    renderModal ( {  isOpen : true ,  onAfterOpen : afterOpenCallback  } ) ; 
20-     expect ( afterOpenCallback . called ) . toBeTruthy ( ) ; 
20+     afterOpenCallback . called . should . be . ok ( ) ; 
2121  } ) ; 
2222
2323  it ( 'keeps focus inside the modal when child has no tabbable elements' ,  ( )  =>  { 
2424    let  tabPrevented  =  false ; 
2525    const  modal  =  renderModal ( {  isOpen : true  } ,  'hello' ) ; 
2626    const  content  =  mcontent ( modal ) ; 
27-     expect ( document . activeElement ) . toEqual ( content ) ; 
27+     document . activeElement . should . be . eql ( content ) ; 
2828    tabKeyDown ( content ,  { 
2929      preventDefault ( )  {  tabPrevented  =  true ;  } 
3030    } ) ; 
31-     expect ( tabPrevented ) . toEqual ( true ) ; 
31+     tabPrevented . should . be . eql ( true ) ; 
3232  } ) ; 
3333
3434  it ( 'handles case when child has no tabbable elements' ,  ( )  =>  { 
3535    const  modal  =  renderModal ( {  isOpen : true  } ,  'hello' ) ; 
3636    const  content  =  mcontent ( modal ) ; 
3737    tabKeyDown ( content ) ; 
38-     expect ( document . activeElement ) . toEqual ( content ) ; 
38+     document . activeElement . should . be . eql ( content ) ; 
3939  } ) ; 
4040
4141  it ( 'should close on Esc key event' ,  ( )  =>  { 
@@ -46,10 +46,10 @@ describe('Events', () => {
4646      onRequestClose : requestCloseCallback 
4747    } ) ; 
4848    escKeyDown ( mcontent ( modal ) ) ; 
49-     expect ( requestCloseCallback . called ) . toBeTruthy ( ) ; 
49+     requestCloseCallback . called . should . be . ok ( ) ; 
5050    // Check if event is passed to onRequestClose callback. 
51-     const  event  =  requestCloseCallback . getCall ( 0 ) . args [ 0 ] ; 
52-     expect ( event ) . toExist ( ) ; 
51+     const  ev  =  requestCloseCallback . getCall ( 0 ) . args [ 0 ] ; 
52+     ev . should . be . ok ( ) ; 
5353  } ) ; 
5454
5555  describe ( 'shouldCloseOnoverlayClick' ,  ( )  =>  { 
@@ -61,7 +61,7 @@ describe('Events', () => {
6161      } ) ; 
6262      const  overlay  =  moverlay ( modal ) ; 
6363      clickAt ( overlay ) ; 
64-       expect ( ! requestCloseCallback . called ) . toBeTruthy ( ) ; 
64+       requestCloseCallback . called . should . not . be . ok ( ) ; 
6565    } ) ; 
6666
6767    it ( 'when true, click on overlay must close' ,  ( )  =>  { 
@@ -72,7 +72,7 @@ describe('Events', () => {
7272        onRequestClose : requestCloseCallback 
7373      } ) ; 
7474      clickAt ( moverlay ( modal ) ) ; 
75-       expect ( requestCloseCallback . called ) . toBeTruthy ( ) ; 
75+       requestCloseCallback . called . should . be . ok ( ) ; 
7676    } ) ; 
7777
7878    it ( 'overlay mouse down and content mouse up, should not close' ,  ( )  =>  { 
@@ -84,7 +84,7 @@ describe('Events', () => {
8484      } ) ; 
8585      mouseDownAt ( moverlay ( modal ) ) ; 
8686      mouseUpAt ( mcontent ( modal ) ) ; 
87-       expect ( ! requestCloseCallback . called ) . toBeTruthy ( ) ; 
87+       requestCloseCallback . called . should . not . be . ok ( ) ; 
8888    } ) ; 
8989
9090    it ( 'content mouse down and overlay mouse up, should not close' ,  ( )  =>  { 
@@ -96,7 +96,7 @@ describe('Events', () => {
9696      } ) ; 
9797      mouseDownAt ( mcontent ( modal ) ) ; 
9898      mouseUpAt ( moverlay ( modal ) ) ; 
99-       expect ( ! requestCloseCallback . called ) . toBeTruthy ( ) ; 
99+       requestCloseCallback . called . should . not . be . ok ( ) ; 
100100    } ) ; 
101101  } ) ; 
102102
@@ -110,7 +110,7 @@ describe('Events', () => {
110110      hasPropagated  =  true ; 
111111    } ) ; 
112112    moverlay ( modal ) . dispatchEvent ( new  MouseEvent ( 'click' ,  {  bubbles : true  } ) ) ; 
113-     expect ( hasPropagated ) . toBeTruthy ( ) ; 
113+     hasPropagated . should . be . ok ( ) ; 
114114  } ) ; 
115115
116116  it ( 'verify event passing on overlay click' ,  ( )  =>  { 
@@ -125,9 +125,9 @@ describe('Events', () => {
125125      // Used to test that this was the event received 
126126      fakeData : 'ABC' 
127127    } ) ; 
128-     expect ( requestCloseCallback . called ) . toBeTruthy ( ) ; 
128+     requestCloseCallback . called . should . be . ok ( ) ; 
129129    // Check if event is passed to onRequestClose callback. 
130130    const  event  =  requestCloseCallback . getCall ( 0 ) . args [ 0 ] ; 
131-     expect ( event ) . toExist ( ) ; 
131+     event . should . be . ok ( ) ; 
132132  } ) ; 
133- } ) ; 
133+ } ; 
0 commit comments