mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
fix(DatabaseModal): prevent errors when pasting text into supported database select (#35916)
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
userEvent,
|
||||
within,
|
||||
waitFor,
|
||||
fireEvent,
|
||||
} from 'spec/helpers/testing-library';
|
||||
import { getExtensionsRegistry } from '@superset-ui/core';
|
||||
import setupCodeOverrides from 'src/setup/setupCodeOverrides';
|
||||
@@ -423,6 +424,27 @@ describe('DatabaseModal', () => {
|
||||
expect(footer).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
test('shows database options when pasting text in the select', async () => {
|
||||
setup();
|
||||
|
||||
const modal = await screen.findByRole('dialog');
|
||||
expect(modal).toBeInTheDocument();
|
||||
|
||||
// Find the select input (not opening the dropdown)
|
||||
const selectInput = screen.getByRole('combobox');
|
||||
expect(selectInput).toBeInTheDocument();
|
||||
|
||||
// Simulate focusing the input
|
||||
userEvent.click(selectInput);
|
||||
|
||||
// Simulate pasting text into the input
|
||||
expect(() =>
|
||||
fireEvent.paste(selectInput, {
|
||||
clipboardData: { getData: () => 'post' },
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
test('renders the "Basic" tab of SQL Alchemy form (step 2 of 2) correctly', async () => {
|
||||
setup();
|
||||
|
||||
|
||||
@@ -1069,6 +1069,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
|
||||
// eslint-disable-next-line camelcase
|
||||
(db: DatabaseObject) => db.name === database_name,
|
||||
)[0];
|
||||
if (!selectedDbModel) return;
|
||||
const {
|
||||
engine,
|
||||
parameters,
|
||||
|
||||
Reference in New Issue
Block a user