Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Color scheme control crashing when dashboardId present #28457

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading