From 7a5327fdba44e2beed96cefa0f3e504a77dbe3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Mon, 19 Aug 2024 22:31:47 +0200 Subject: [PATCH] Fix MenuRoot test to remove a race condition --- packages/mui-base/src/Menu/Root/MenuRoot.test.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/mui-base/src/Menu/Root/MenuRoot.test.tsx b/packages/mui-base/src/Menu/Root/MenuRoot.test.tsx index 6e9fe0c83..bbf677ddf 100644 --- a/packages/mui-base/src/Menu/Root/MenuRoot.test.tsx +++ b/packages/mui-base/src/Menu/Root/MenuRoot.test.tsx @@ -205,17 +205,11 @@ describe('', () => { expect(items[1]).to.have.attribute('tabindex', '0'); }); - await user.keyboard('b'); - await waitFor(() => { - expect(items[2]).toHaveFocus(); - }); - expect(items[2]).to.have.attribute('tabindex', '0'); - - await user.keyboard('b'); + await user.keyboard('c'); await waitFor(() => { - expect(items[2]).toHaveFocus(); + expect(items[3]).toHaveFocus(); }); - expect(items[2]).to.have.attribute('tabindex', '0'); + expect(items[3]).to.have.attribute('tabindex', '0'); }); it('skips the non-stringifiable items', async function test() {