File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -119,3 +119,24 @@ it('moves the focus to the menu button after pressing escape while focused on a
119119 firstMenuItem . simulate ( 'keydown' , { key : 'Escape' } ) ;
120120 expect ( document . activeElement ?. id ) . toBe ( 'menu-button' ) ;
121121} ) ;
122+
123+ it ( 'opens the menu after clicking the button' , ( ) => {
124+ const component = mount ( < TestComponent /> ) ;
125+ const button = component . find ( '#menu-button' ) ;
126+ const span = component . find ( '#is-open-indicator' ) ;
127+
128+ button . simulate ( 'click' ) ;
129+
130+ expect ( span . text ( ) ) . toBe ( 'true' ) ;
131+ } ) ;
132+
133+ it ( 'closes the menu after clicking the button when the menu is open' , ( ) => {
134+ const component = mount ( < TestComponent /> ) ;
135+ const button = component . find ( '#menu-button' ) ;
136+ const span = component . find ( '#is-open-indicator' ) ;
137+
138+ button . simulate ( 'click' ) ;
139+ button . simulate ( 'click' ) ;
140+
141+ expect ( span . text ( ) ) . toBe ( 'false' ) ;
142+ } ) ;
You can’t perform that action at this time.
0 commit comments