From 515986172f0954b01ad72d19cdb7b2ac0798f60f Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Thu, 18 May 2023 12:53:13 -0700 Subject: [PATCH] fix(sqllab): Disable Select All on table selector (#24120) --- .../TableSelector/TableSelector.test.tsx | 21 ++++++++++++++++++- .../src/components/TableSelector/index.tsx | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/components/TableSelector/TableSelector.test.tsx b/superset-frontend/src/components/TableSelector/TableSelector.test.tsx index f6107d4cacb25..78af066ce67e3 100644 --- a/superset-frontend/src/components/TableSelector/TableSelector.test.tsx +++ b/superset-frontend/src/components/TableSelector/TableSelector.test.tsx @@ -95,7 +95,26 @@ test('renders with default props', async () => { }); }); -test('renders table options', async () => { +test('skips select all options', async () => { + fetchMock.get(schemaApiRoute, { result: ['test_schema'] }); + fetchMock.get(tablesApiRoute, getTableMockFunction()); + + const props = createProps(); + render(, { + useRedux: true, + store, + }); + const tableSelect = screen.getByRole('combobox', { + name: 'Select table or type to search tables', + }); + userEvent.click(tableSelect); + expect( + await screen.findByRole('option', { name: 'table_a' }), + ).toBeInTheDocument(); + expect(screen.queryByRole('option', { name: /Select All/i })).toBeFalsy(); +}); + +test('renders table options without Select All option', async () => { fetchMock.get(schemaApiRoute, { result: ['test_schema'] }); fetchMock.get(tablesApiRoute, getTableMockFunction()); diff --git a/superset-frontend/src/components/TableSelector/index.tsx b/superset-frontend/src/components/TableSelector/index.tsx index 6fcbdb3a57b7f..7c2a809e5cf36 100644 --- a/superset-frontend/src/components/TableSelector/index.tsx +++ b/superset-frontend/src/components/TableSelector/index.tsx @@ -297,6 +297,7 @@ const TableSelector: FunctionComponent = ({ mode={tableSelectMode} value={tableSelectValue} allowClear={tableSelectMode === 'multiple'} + allowSelectAll={false} /> );