forked from deephaven/web-client-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Colorway to single var - Renamed chart theme init deephaven#1572
- Loading branch information
Showing
9 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// <reference types="./declaration" /> | ||
|
||
import { TestUtils } from '@deephaven/utils'; | ||
import { resolveCssVariablesInRecord } from '@deephaven/components'; | ||
import { defaultChartTheme } from './ChartTheme'; | ||
import chartThemeRaw from './ChartTheme.module.scss'; | ||
|
||
jest.mock('@deephaven/components', () => ({ | ||
...jest.requireActual('@deephaven/components'), | ||
resolveCssVariablesInRecord: jest.fn(), | ||
})); | ||
|
||
const { asMock } = TestUtils; | ||
|
||
const mockChartTheme = new Proxy( | ||
{}, | ||
{ get: (_target, name) => `chartTheme['${String(name)}']` } | ||
); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
expect.hasAssertions(); | ||
|
||
asMock(resolveCssVariablesInRecord) | ||
.mockName('resolveCssVariablesInRecord') | ||
.mockReturnValue(mockChartTheme); | ||
}); | ||
|
||
describe('defaultChartTheme', () => { | ||
it('should create the default chart theme', () => { | ||
const actual = defaultChartTheme(); | ||
|
||
expect(resolveCssVariablesInRecord).toHaveBeenCalledWith(chartThemeRaw); | ||
expect(actual).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`defaultChartTheme should create the default chart theme 1`] = ` | ||
{ | ||
"activecolor": "chartTheme['activecolor']", | ||
"area_color": "chartTheme['area-color']", | ||
"colorway": "chartTheme['colorway']", | ||
"error_band_fill_color": "chartTheme['error-band-fill-color']", | ||
"error_band_line_color": "chartTheme['error-band-line-color']", | ||
"gridcolor": "chartTheme['gridcolor']", | ||
"line_color": "chartTheme['line-color']", | ||
"linecolor": "chartTheme['linecolor']", | ||
"ohlc_decreasing": "chartTheme['ohlc-decreasing']", | ||
"ohlc_increasing": "chartTheme['ohlc-increasing']", | ||
"paper_bgcolor": "chartTheme['paper-bgcolor']", | ||
"plot_bgcolor": "chartTheme['plot-bgcolor']", | ||
"rangebgcolor": "chartTheme['rangebgcolor']", | ||
"title_color": "chartTheme['title-color']", | ||
"trend_color": "chartTheme['trend-color']", | ||
"zerolinecolor": "chartTheme['zerolinecolor']", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters