Skip to content

Commit 2671b44

Browse files
PelayoFelguerosoJialecl
authored andcommitted
add test
1 parent 4aa391c commit 2671b44

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎packages/lib/src/text-input/TextInput.test.tsx‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,23 @@ describe("TextInput component synchronous autosuggest tests", () => {
910910
expect(list).toBeTruthy();
911911
expect(getAllByText("?").length).toBe(1);
912912
});
913+
914+
test("Autosuggest scrollbar behaviour", () => {
915+
const onChange = jest.fn();
916+
const { getByRole, queryByRole } = render(
917+
<DxcTextInput label="Autocomplete Countries" suggestions={countries} onChange={onChange} />
918+
);
919+
const input = getByRole("combobox");
920+
fireEvent.focus(input);
921+
const list = getByRole("listbox");
922+
expect(list).toBeTruthy();
923+
924+
const suggestionsContainer = list.parentElement;
925+
fireEvent.mouseDown(suggestionsContainer!);
926+
expect(getByRole("listbox")).toBeTruthy();
927+
fireEvent.blur(input);
928+
expect(queryByRole("listbox")).toBeFalsy();
929+
});
913930
});
914931

915932
describe("TextInput component asynchronous autosuggest tests", () => {

0 commit comments

Comments
 (0)