mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(frontend): remove describe/it blocks from Modal.useModal tests (#35497)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -174,6 +174,7 @@ test('adds extension to DashboardEmbedModal', async () => {
|
||||
extensionsRegistry.set('embedded.modal', undefined);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
|
||||
describe('Modal.useModal integration', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
@@ -201,12 +201,13 @@ describe('ThemesList', () => {
|
||||
expect(addButton).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
|
||||
describe('Modal.useModal integration', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('uses Modal.useModal hook instead of Modal.confirm', () => {
|
||||
test('uses Modal.useModal hook instead of Modal.confirm', () => {
|
||||
const useModalSpy = jest.spyOn(Modal, 'useModal');
|
||||
renderThemesList();
|
||||
|
||||
@@ -216,7 +217,7 @@ describe('ThemesList', () => {
|
||||
useModalSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('renders contextHolder for modal theming', async () => {
|
||||
test('renders contextHolder for modal theming', async () => {
|
||||
const { container } = renderThemesList();
|
||||
|
||||
// Wait for component to be rendered
|
||||
@@ -228,7 +229,7 @@ describe('ThemesList', () => {
|
||||
expect(contextHolderExists).toBeDefined();
|
||||
});
|
||||
|
||||
it('confirms system theme changes using themed modal', async () => {
|
||||
test('confirms system theme changes using themed modal', async () => {
|
||||
const mockSetSystemDefault = jest.fn().mockResolvedValue({});
|
||||
fetchMock.post(
|
||||
'glob:*/api/v1/theme/*/set_system_default',
|
||||
@@ -246,7 +247,7 @@ describe('ThemesList', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
|
||||
it('does not use deprecated Modal.confirm directly', () => {
|
||||
test('does not use deprecated Modal.confirm directly', () => {
|
||||
// Create a spy on the static Modal.confirm method
|
||||
const confirmSpy = jest.spyOn(Modal, 'confirm');
|
||||
|
||||
|
||||
@@ -294,10 +294,7 @@ function ThemesList({
|
||||
theme.theme_name,
|
||||
),
|
||||
onConfirm: () => setSystemDarkTheme(theme.id!),
|
||||
successMessage: t(
|
||||
'"%s" is now the system dark theme',
|
||||
theme.theme_name,
|
||||
),
|
||||
successMessage: t('"%s" is now the system dark theme', theme.theme_name),
|
||||
errorMessage: 'Failed to set system dark theme: %s',
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user