Skip to content

Commit c7ec867

Browse files
joshblackCopilot
andcommitted
test: wait for SelectPanel initial focus state
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bca3ca2 commit c7ec867

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

packages/react/src/SelectPanel/SelectPanel.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,11 +1673,10 @@ for (const usingRemoveActiveDescendant of [false, true]) {
16731673
const input = screen.getByPlaceholderText('Filter items')
16741674
const options = screen.getAllByRole('option')
16751675

1676-
// Wait a tick for the effect to run
1677-
await new Promise(resolve => setTimeout(resolve, 0))
1678-
1679-
// aria-activedescendant should be set to the first item
1680-
expect(input.getAttribute('aria-activedescendant')).toBe(options[0].id)
1676+
await waitFor(() => {
1677+
// aria-activedescendant should be set to the first item
1678+
expect(input.getAttribute('aria-activedescendant')).toBe(options[0].id)
1679+
})
16811680
})
16821681

16831682
it('should not set aria-activedescendant on mouse hover until after first interaction when setInitialFocus is true', async () => {

0 commit comments

Comments
 (0)