mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
fix: Edit physical dataset from the Edit Dataset modal (#15770)
* Remove unnecessary onChange * Remove confliciting onChange * Revert unnecessary change * Enhance and fix tests
This commit is contained in:
@@ -38,7 +38,7 @@ const createProps = () => ({
|
||||
onDbChange: jest.fn(),
|
||||
onSchemaChange: jest.fn(),
|
||||
onSchemasLoad: jest.fn(),
|
||||
onChange: jest.fn(),
|
||||
onUpdate: jest.fn(),
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -161,7 +161,7 @@ test('Refresh should work', async () => {
|
||||
expect(props.onDbChange).toBeCalledTimes(0);
|
||||
expect(props.onSchemaChange).toBeCalledTimes(0);
|
||||
expect(props.onSchemasLoad).toBeCalledTimes(1);
|
||||
expect(props.onChange).toBeCalledTimes(0);
|
||||
expect(props.onUpdate).toBeCalledTimes(0);
|
||||
});
|
||||
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
@@ -174,7 +174,7 @@ test('Refresh should work', async () => {
|
||||
expect(props.onDbChange).toBeCalledTimes(1);
|
||||
expect(props.onSchemaChange).toBeCalledTimes(1);
|
||||
expect(props.onSchemasLoad).toBeCalledTimes(2);
|
||||
expect(props.onChange).toBeCalledTimes(1);
|
||||
expect(props.onUpdate).toBeCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ interface DatabaseSelectorProps {
|
||||
readOnly?: boolean;
|
||||
schema?: string;
|
||||
sqlLabMode?: boolean;
|
||||
onChange?: ({
|
||||
onUpdate?: ({
|
||||
dbId,
|
||||
schema,
|
||||
}: {
|
||||
@@ -89,7 +89,7 @@ export default function DatabaseSelector({
|
||||
getTableList,
|
||||
handleError,
|
||||
isDatabaseSelectEnabled = true,
|
||||
onChange,
|
||||
onUpdate,
|
||||
onDbChange,
|
||||
onSchemaChange,
|
||||
onSchemasLoad,
|
||||
@@ -143,8 +143,8 @@ export default function DatabaseSelector({
|
||||
function onSelectChange({ dbId, schema }: { dbId: number; schema?: string }) {
|
||||
setCurrentDbId(dbId);
|
||||
setCurrentSchema(schema);
|
||||
if (onChange) {
|
||||
onChange({ dbId, schema, tableName: undefined });
|
||||
if (onUpdate) {
|
||||
onUpdate({ dbId, schema, tableName: undefined });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user