-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): Add thumbnails to dashboard edit draggable chart list (
#20528) * Add chart thumbnails to dashboard edit draggable charts. * Reorganize hierarchy and add tests. * Incorporate review suggestions. * Update design and add tooltips. * Fix missing thumbnails. * Fix tests. * Fix moving viz type label. * Convert AddSliceCard to TS, update hierarchy.
- Loading branch information
Showing
6 changed files
with
367 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 0 additions & 148 deletions
148
superset-frontend/src/dashboard/components/AddSliceCard.jsx
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { FeatureFlag } from '@superset-ui/core'; | ||
import { act, render, screen } from 'spec/helpers/testing-library'; | ||
import AddSliceCard from '.'; | ||
|
||
jest.mock('src/components/DynamicPlugins', () => ({ | ||
usePluginContext: () => ({ | ||
mountedPluginMetadata: { table: { name: 'Table' } }, | ||
}), | ||
})); | ||
|
||
const mockedProps = { | ||
visType: 'table', | ||
sliceName: '-', | ||
}; | ||
|
||
declare const global: { | ||
featureFlags: Record<string, boolean>; | ||
}; | ||
|
||
test('do not render thumbnail if feature flag is not set', async () => { | ||
global.featureFlags = { | ||
[FeatureFlag.THUMBNAILS]: false, | ||
}; | ||
|
||
await act(async () => { | ||
render(<AddSliceCard {...mockedProps} />); | ||
}); | ||
|
||
expect(screen.queryByTestId('thumbnail')).not.toBeInTheDocument(); | ||
}); | ||
|
||
test('render thumbnail if feature flag is set', async () => { | ||
global.featureFlags = { | ||
[FeatureFlag.THUMBNAILS]: true, | ||
}; | ||
|
||
await act(async () => { | ||
render(<AddSliceCard {...mockedProps} />); | ||
}); | ||
|
||
expect(screen.queryByTestId('thumbnail')).toBeInTheDocument(); | ||
}); |
Oops, something went wrong.