Skip to content

Commit

Permalink
fix: Color scheme control crashing when dashboardId present (apache#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje authored and EnxDev committed May 31, 2024
1 parent b053f00 commit b3d719a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3d719a

Please sign in to comment.