From b49818ec475b4b51296c903be5563e10a8dd4d8e Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 8 Nov 2022 20:06:22 +0200 Subject: [PATCH] Update test --- .../TableSelector/TableSelector.test.tsx | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/superset-frontend/src/components/TableSelector/TableSelector.test.tsx b/superset-frontend/src/components/TableSelector/TableSelector.test.tsx index 3f74e7781ed17..5b3fac1f94cf3 100644 --- a/superset-frontend/src/components/TableSelector/TableSelector.test.tsx +++ b/superset-frontend/src/components/TableSelector/TableSelector.test.tsx @@ -216,12 +216,8 @@ test('table multi select retain all the values selected', async () => { userEvent.click(tableSelect); - expect( - await screen.findByRole('option', { name: 'table_a' }), - ).toBeInTheDocument(); - act(() => { - const item = screen.getAllByText('table_a'); + const item = screen.getAllByText('table_b'); userEvent.click(item[item.length - 1]); }); @@ -230,17 +226,13 @@ test('table multi select retain all the values selected', async () => { userEvent.click(item[item.length - 1]); }); - const selectedValueContainer = getSelectItemContainer(tableSelect); + expect(screen.getByRole('option', { name: 'table_b' })).toHaveAttribute( + 'aria-selected', + 'true', + ); - expect(selectedValueContainer).toHaveLength(2); - expect( - await within(selectedValueContainer?.[0] as HTMLElement).findByText( - 'table_a', - ), - ).toBeInTheDocument(); - expect( - await within(selectedValueContainer?.[1] as HTMLElement).findByText( - 'table_c', - ), - ).toBeInTheDocument(); + expect(screen.getByRole('option', { name: 'table_c' })).toHaveAttribute( + 'aria-selected', + 'true', + ); });