File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -88,4 +88,18 @@ describe('useIsActive', () => {
8888 wrapper . setProps ( { params : { param : 'bar' } } ) . update ( ) ;
8989 expect ( wrapper . find ( 'div' ) . props ( ) . className ) . toBe ( 'yesactive' ) ;
9090 } ) ;
91+
92+ it ( 'updates when the active state changes' , async ( ) => {
93+ await routerGo ( 'state2' ) ;
94+ const wrapper = mountInRouter ( < TestComponent state = "state1" params = { null } exact = { false } /> ) ;
95+ expect ( wrapper . find ( 'div' ) . props ( ) . className ) . toBe ( 'notactive' ) ;
96+
97+ await routerGo ( 'state1' ) ;
98+ wrapper . update ( ) ;
99+ expect ( wrapper . find ( 'div' ) . props ( ) . className ) . toBe ( 'yesactive' ) ;
100+
101+ await routerGo ( 'state2' ) ;
102+ wrapper . update ( ) ;
103+ expect ( wrapper . find ( 'div' ) . props ( ) . className ) . toBe ( 'notactive' ) ;
104+ } ) ;
91105} ) ;
You can’t perform that action at this time.
0 commit comments