File tree Expand file tree Collapse file tree
extensions/ql-vscode/src/view/common/SuggestBox/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { render as reactRender , screen } from "@testing-library/react" ;
1+ import { render as reactRender , screen , waitFor } from "@testing-library/react" ;
22import type { SuggestBoxProps } from "../SuggestBox" ;
33import { SuggestBox } from "../SuggestBox" ;
44import { userEvent } from "@testing-library/user-event" ;
@@ -200,6 +200,9 @@ describe("SuggestBox", () => {
200200 } ) ;
201201
202202 await userEvent . click ( screen . getByRole ( "combobox" ) ) ;
203+
204+ expect ( screen . getAllByRole ( "option" ) ) . not . toHaveLength ( 0 ) ;
205+
203206 await userEvent . keyboard ( "{Enter}" ) ;
204207
205208 expect ( screen . queryByRole ( "option" ) ) . not . toBeInTheDocument ( ) ;
@@ -211,9 +214,14 @@ describe("SuggestBox", () => {
211214 } ) ;
212215
213216 await userEvent . click ( screen . getByRole ( "combobox" ) ) ;
217+
218+ expect ( screen . getAllByRole ( "option" ) ) . not . toHaveLength ( 0 ) ;
219+
214220 await userEvent . keyboard ( "{Tab}" ) ;
215221
216- expect ( screen . queryByRole ( "option" ) ) . not . toBeInTheDocument ( ) ;
222+ await waitFor ( ( ) => {
223+ expect ( screen . queryByRole ( "option" ) ) . not . toBeInTheDocument ( ) ;
224+ } ) ;
217225 } ) ;
218226
219227 it ( "shows no suggestions with no matching followup options" , async ( ) => {
You can’t perform that action at this time.
0 commit comments