File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ import Modal from './Modal' ;
4+ import store from '../store/index' ;
5+
6+ test ( 'modal accepts childrens' , ( ) => {
7+ const component = mount ( < Modal store = { store } > < div className = "childrens" > childrens</ div > </ Modal > ) ,
8+ result = component . find ( '.childrens' ) ;
9+ expect ( result . text ( ) ) . toBe ( 'childrens' ) ;
10+ } ) ;
11+
12+ test ( 'modal click on Close button dispatches MODAL_CLOSE' , ( ) => {
13+ const spy = jest . spyOn ( store , 'dispatch' ) ,
14+ component = mount ( < Modal store = { store } modalClose = { spy } /> ) ,
15+ close = component . find ( 'CustomButton' ) ;
16+
17+ close . simulate ( 'click' ) ;
18+ expect ( spy ) . toHaveBeenCalled ( ) ;
19+ expect ( spy . mock . calls [ 0 ] [ 0 ] . type ) . toEqual ( "MODAL_CLOSE" ) ;
20+ } ) ;
21+
22+ test ( 'MODAL_OPEN sets status true' , ( ) => {
23+ mount ( < Modal store = { store } /> ) ;
24+
25+ store . dispatch ( { type : "MODAL_OPEN" , payload : null } ) ;
26+ expect ( store . getState ( ) . modal . status ) . toBe ( true ) ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments