Skip to content

Commit 0d34529

Browse files
committed
Update Menu.test.js
1 parent dccd21e commit 0d34529

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

packages/mui-material/test/integration/Menu.test.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -277,21 +277,28 @@ describe('<Menu /> integration', () => {
277277
// no case for menu
278278
// TODO: should this even change focus? I would guess that autoFocus={false}
279279
// means "developer: I take care of focus don't steal it from me"
280-
specify('[variant=selectedMenu] focuses no part of the menu when `autoFocus={false}`', async () => {
281-
const { getAllByRole, getByTestId } = await render(
282-
<OpenMenu autoFocus={false} variant="selectedMenu" PaperProps={{ 'data-testid': 'Paper' }}>
283-
<MenuItem />
284-
<MenuItem selected />
285-
<MenuItem />
286-
</OpenMenu>,
287-
);
288-
const menuitems = getAllByRole('menuitem');
280+
specify(
281+
'[variant=selectedMenu] focuses no part of the menu when `autoFocus={false}`',
282+
async () => {
283+
const { getAllByRole, getByTestId } = await render(
284+
<OpenMenu
285+
autoFocus={false}
286+
variant="selectedMenu"
287+
PaperProps={{ 'data-testid': 'Paper' }}
288+
>
289+
<MenuItem />
290+
<MenuItem selected />
291+
<MenuItem />
292+
</OpenMenu>,
293+
);
294+
const menuitems = getAllByRole('menuitem');
289295

290-
expect(getByTestId('Paper')).toHaveFocus();
291-
expect(menuitems[0]).to.have.property('tabIndex', -1);
292-
expect(menuitems[1]).to.have.property('tabIndex', 0);
293-
expect(menuitems[2]).to.have.property('tabIndex', -1);
294-
});
296+
expect(getByTestId('Paper')).toHaveFocus();
297+
expect(menuitems[0]).to.have.property('tabIndex', -1);
298+
expect(menuitems[1]).to.have.property('tabIndex', 0);
299+
expect(menuitems[2]).to.have.property('tabIndex', -1);
300+
},
301+
);
295302

296303
specify('[variant=selectedMenu] focuses nothing when it is closed and mounted', async () => {
297304
const { getByRole } = await render(<ButtonMenu selectedIndex={1} variant="selectedMenu" />);

0 commit comments

Comments
 (0)