fix(sqllab): Disable Select All on table selector (#24120)

This commit is contained in:
JUST.in DO IT 2023-05-18 12:53:13 -07:00 committed by GitHub
parent 2222073778
commit 515986172f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -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(<TableSelector {...props} tableSelectMode="multiple" />, {
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());

View File

@ -297,6 +297,7 @@ const TableSelector: FunctionComponent<TableSelectorProps> = ({
mode={tableSelectMode}
value={tableSelectValue}
allowClear={tableSelectMode === 'multiple'}
allowSelectAll={false}
/>
);