mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Fixed failing tests because of circular dependency
This commit is contained in:
parent
75e9c1e8fc
commit
996588528a
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { getTheme } from './index';
|
||||
import { getTheme } from './getTheme';
|
||||
import { GrafanaThemeType, Themeable } from '../types/theme';
|
||||
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
15
packages/grafana-ui/src/themes/getTheme.ts
Normal file
15
packages/grafana-ui/src/themes/getTheme.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import darkTheme from './dark';
|
||||
import lightTheme from './light';
|
||||
import { GrafanaTheme } from '../types/theme';
|
||||
|
||||
let themeMock: ((name?: string) => GrafanaTheme) | null;
|
||||
|
||||
export const getTheme = (name?: string) =>
|
||||
(themeMock && themeMock(name)) || (name === 'light' ? lightTheme : darkTheme);
|
||||
|
||||
export const mockTheme = (mock: (name?: string) => GrafanaTheme) => {
|
||||
themeMock = mock;
|
||||
return () => {
|
||||
themeMock = null;
|
||||
};
|
||||
};
|
@ -1,17 +1,4 @@
|
||||
import darkTheme from './dark';
|
||||
import lightTheme from './light';
|
||||
import { GrafanaTheme } from '../types/theme';
|
||||
import { ThemeContext, withTheme } from './ThemeContext';
|
||||
import { getTheme, mockTheme } from './getTheme';
|
||||
|
||||
let themeMock: ((name?: string) => GrafanaTheme) | null;
|
||||
|
||||
export let getTheme = (name?: string) => (themeMock && themeMock(name)) || (name === 'light' ? lightTheme : darkTheme);
|
||||
|
||||
export const mockTheme = (mock: (name?: string) => GrafanaTheme) => {
|
||||
themeMock = mock;
|
||||
return () => {
|
||||
themeMock = null;
|
||||
};
|
||||
};
|
||||
|
||||
export { ThemeContext, withTheme };
|
||||
export { ThemeContext, withTheme, mockTheme, getTheme };
|
||||
|
Loading…
Reference in New Issue
Block a user