From ccf8accb58629e1eece5106ad37975e18e49250e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B5=D1=83=D1=82=D0=BE=D0=B2=20=D0=94=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=D0=B0=20=D0=92=D0=B0=D0=BB=D0=B5=D1=80=D1=8C=D0=B5?= =?UTF-8?q?=D0=B2=D0=B8=D1=87?= Date: Sat, 30 Mar 2024 15:09:58 +0300 Subject: [PATCH] add multidropdown tests --- src/__test__/MultiDropdown.test.tsx | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/__test__/MultiDropdown.test.tsx b/src/__test__/MultiDropdown.test.tsx index e845803..5399f7e 100644 --- a/src/__test__/MultiDropdown.test.tsx +++ b/src/__test__/MultiDropdown.test.tsx @@ -253,4 +253,36 @@ describe('Тестирование компонента MultiDropdown', () => { expect(secondOption).not.toBeInTheDocument(); }); + + test('Проверка фильтрации', () => { + const title = 'TEST_TITLE'; + render( + title} /> + ); + + const dropdownElement = screen.getByDisplayValue(''); + expect(dropdownElement).toBeInTheDocument(); + + userEvent.click(dropdownElement); + + const firstOption = screen.getByText(options[0].value); + const secondOption = screen.getByText(options[1].value); + const thirdOption = screen.getByText(options[2].value); + + expect(firstOption).toBeInTheDocument(); + expect(secondOption).toBeInTheDocument(); + expect(thirdOption).toBeInTheDocument(); + + userEvent.type(dropdownElement, 'Екат'); + + expect(firstOption).not.toBeInTheDocument(); + expect(secondOption).not.toBeInTheDocument(); + expect(thirdOption).toBeInTheDocument(); + + userEvent.clear(dropdownElement); + + expect(screen.getByText(options[0].value)).toBeInTheDocument(); + expect(screen.getByText(options[1].value)).toBeInTheDocument(); + expect(screen.getByText(options[2].value)).toBeInTheDocument(); + }); });