From 7887ef65cf037aea5cc6e845ea8a3193ccdb8261 Mon Sep 17 00:00:00 2001 From: Marek Mihok Date: Fri, 8 Dec 2023 12:23:06 +0100 Subject: [PATCH] chore: fix failing UI unit tests (#2221) --- ui/src/combobox.test.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ui/src/combobox.test.tsx b/ui/src/combobox.test.tsx index 20413c855e..23da951193 100644 --- a/ui/src/combobox.test.tsx +++ b/ui/src/combobox.test.tsx @@ -56,15 +56,15 @@ describe('Combobox.tsx', () => { }) it('Adds new typed option only once to options list', () => { - const { getAllByRole, getByRole, queryAllByTitle, } = render() + const { getAllByRole, getByRole, queryAllByText } = render() fireEvent.click(getByRole('presentation', { hidden: true })) expect(getAllByRole('option')).toHaveLength(3) - expect(queryAllByTitle('D')).toHaveLength(0) + expect(queryAllByText('D')).toHaveLength(0) userEvent.type(getByRole('combobox'), '{backspace}D{enter}') fireEvent.click(getByRole('presentation', { hidden: true })) expect(getAllByRole('option')).toHaveLength(4) - expect(queryAllByTitle('D')).toHaveLength(1) + expect(queryAllByText('D')).toHaveLength(1) }) describe('Wave args', () => { @@ -78,13 +78,13 @@ describe('Combobox.tsx', () => { }) it('Sets args to manually selected option', () => { - const { getByRole, getByTitle } = render() + const { getByRole, getByText } = render() fireEvent.click(getByRole('presentation', { hidden: true })) - fireEvent.click(getByTitle('A')) + fireEvent.click(getByText('A')) expect(wave.args[name]).toBe('A') fireEvent.click(getByRole('presentation', { hidden: true })) - fireEvent.click(getByTitle('B')) + fireEvent.click(getByText('B')) expect(wave.args[name]).toBe('B') }) @@ -206,23 +206,23 @@ describe('Combobox.tsx', () => { }) it('Adds initial value to options if it\'s not included in "choices" prop', () => { - const { getByTitle, getAllByRole, getByRole } = render() + const { getByText, getAllByRole, getByRole } = render() expect(wave.args[name]).toEqual('Z') expect(getByRole('combobox')).toHaveValue('Z') fireEvent.click(getByRole('presentation', { hidden: true })) expect(getAllByRole('option')).toHaveLength(4) - expect(getByTitle('Z')).toBeDefined() + expect(getByText('Z')).toBeDefined() }) it('Adds value to choices when both are updated and value was included in previous choices but not in the new choices', () => { - const { getByRole, getAllByRole, getByTitle, rerender } = render() + const { getByRole, getAllByRole, getByText, rerender } = render() expect(getByRole('combobox')).toHaveValue('A') rerender() expect(getByRole('combobox')).toHaveValue('C') fireEvent.click(getByRole('presentation', { hidden: true })) expect(getAllByRole('option')).toHaveLength(3) - expect(getByTitle('C')).toBeDefined() + expect(getByText('C')).toBeDefined() }) it('Display same value if choices change and value is included in choices', () => { @@ -324,12 +324,12 @@ describe('Combobox.tsx', () => { }) it('Adds initial values to options if they are not already included in options ', () => { - const { getByTitle, getAllByRole, getByRole } = render() + const { getByText, getAllByRole, getByRole } = render() expect(wave.args[name]).toEqual('Z') expect(getByRole('combobox')).toHaveValue('Z') fireEvent.click(getByRole('presentation', { hidden: true })) expect(getAllByRole('option')).toHaveLength(4) - expect(getByTitle('Z')).toBeDefined() + expect(getByText('Z')).toBeDefined() }) }) })