You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/use-dropdown-menu.test.tsx
+8-6
Original file line number
Diff line number
Diff line change
@@ -95,16 +95,16 @@ it('Moves the focus to the first menu item after pressing space while focused on
95
95
expect(screen.getByText('1 Item')).toHaveFocus();
96
96
});
97
97
98
-
it('Moves the focus to the first menu item after clicking the menu to open it',async()=>{
99
-
const{ user }=setup(<TestComponent/>);
98
+
it('Moves the focus to the first menu item after clicking the menu to open it, if `focusFirstItemOnClick` is specified',async()=>{
99
+
const{ user }=setup(<TestComponentoptions={{focusFirstItemOnClick: true}}/>);
100
100
101
101
awaituser.click(screen.getByText('Primary'));
102
102
103
103
expect(screen.getByText('1 Item')).toHaveFocus();
104
104
});
105
105
106
-
it('Moves the focus to the first menu item after clicking the menu to open it, then pressing tab while focused on the menu button, if `disableFocusFirstItemOnClick` is specified',async()=>{
107
-
const{ user }=setup(<TestComponentoptions={{disableFocusFirstItemOnClick: true}}/>);
106
+
it('Moves the focus to the first menu item after clicking the menu to open it, then pressing tab while focused on the menu button',async()=>{
107
+
const{ user }=setup(<TestComponent/>);
108
108
109
109
awaituser.click(screen.getByText('Primary'));
110
110
@@ -115,8 +115,8 @@ it('Moves the focus to the first menu item after clicking the menu to open it, t
115
115
expect(screen.getByText('1 Item')).toHaveFocus();
116
116
});
117
117
118
-
it('Moves the focus to the first menu item after clicking the menu to open it, then pressing arrow down while focused on the menu button, if `disableFocusFirstItemOnClick` is specified',async()=>{
119
-
const{ user }=setup(<TestComponentoptions={{disableFocusFirstItemOnClick: true}}/>);
118
+
it('Moves the focus to the first menu item after clicking the menu to open it, then pressing arrow down while focused on the menu button',async()=>{
119
+
const{ user }=setup(<TestComponent/>);
120
120
121
121
awaituser.click(screen.getByText('Primary'));
122
122
@@ -308,6 +308,8 @@ it('Can navigate to a dynamically-added item', async () => {
`disableFocusFirstItemOnClick` | If specified as `true` the default behavior of focusing the first menu item on click will be disabled. The menu button will instead retain focus.
13
+
`focusFirstItemOnClick` | If specified as `true`, the first menu item will be focused when the menu is opened via a click (in addition to via a keyboard interaction).
0 commit comments