mirror of https://github.com/apache/superset.git
fix: Color scheme control crashing when dashboardId present (#28457)
This commit is contained in:
parent
e1cd0547de
commit
983f809951
|
@ -127,3 +127,11 @@ test('displays color scheme options', async () => {
|
|||
expect(screen.getByText('Other color palettes')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
test('Renders control with dashboard id', () => {
|
||||
setup({ dashboardId: 1 });
|
||||
expect(screen.getByText('Dashboard scheme')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByLabelText('Select color scheme', { selector: 'input' }),
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
|
|
@ -125,13 +125,9 @@ const ColorSchemeControl = ({
|
|||
const options = useMemo(() => {
|
||||
if (dashboardId) {
|
||||
return [
|
||||
{
|
||||
value: 'dashboard',
|
||||
label: t('dashboard'),
|
||||
customLabel: (
|
||||
<Tooltip title={DASHBOARD_ALERT}>{t('Dashboard scheme')}</Tooltip>
|
||||
),
|
||||
},
|
||||
<Option value="dashboard" label={t('dashboard')} key="dashboard">
|
||||
<Tooltip title={DASHBOARD_ALERT}>{t('Dashboard scheme')}</Tooltip>
|
||||
</Option>,
|
||||
];
|
||||
}
|
||||
const schemesObject = isFunction(schemes) ? schemes() : schemes;
|
||||
|
|
Loading…
Reference in New Issue