bui-themer: remove unnecessary matchMedia mocks
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -20,21 +20,6 @@ import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { BuiThemePreview } from './BuiThemePreview';
|
||||
|
||||
describe('BuiThemePreview', () => {
|
||||
beforeAll(() => {
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(query => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
});
|
||||
it('renders headings and sample components', async () => {
|
||||
const { container } = await renderInTestApp(
|
||||
<BuiThemePreview
|
||||
|
||||
@@ -33,21 +33,6 @@ function makeAppTheme(id: string, title: string, variant: 'light' | 'dark') {
|
||||
}
|
||||
|
||||
describe('BuiThemerPage', () => {
|
||||
beforeAll(() => {
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(query => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
});
|
||||
it('renders empty state when no themes installed', async () => {
|
||||
const apis = [[appThemeApiRef, { getInstalledThemes: () => [] }]] as const;
|
||||
await renderInTestApp(
|
||||
|
||||
@@ -30,22 +30,6 @@ jest.mock('./convertMuiToBuiTheme', () => ({
|
||||
describe('ThemeContent', () => {
|
||||
const muiTheme = createTheme();
|
||||
|
||||
beforeAll(() => {
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(query => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
it('renders title, variant and tabs', async () => {
|
||||
await renderInTestApp(
|
||||
<ThemeContent
|
||||
|
||||
Reference in New Issue
Block a user