mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added test for SASS variable retrieval function from JS definition
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
const darkTheme = require('./dark');
|
||||
const lightTheme = require('./light');
|
||||
|
||||
const getTheme = name => (name === 'light' ? lightTheme : darkTheme);
|
||||
let mockedTheme;
|
||||
|
||||
let getTheme = name => mockedTheme || (name === 'light' ? lightTheme : darkTheme);
|
||||
|
||||
const mockTheme = mock => {
|
||||
const originalGetTheme = getTheme;
|
||||
getTheme = () => mock;
|
||||
return () => (getTheme = originalGetTheme);
|
||||
mockedTheme = mock;
|
||||
return () => (mockedTheme = null);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getTheme,
|
||||
mockTheme
|
||||
mockTheme,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user