Skip to content

Commit 81cb823

Browse files
[charts] advance time in charts regression tests
1 parent 881de93 commit 81cb823

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/regressions/TestViewer.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const StyledBox = styled('div', {
3131
);
3232

3333
function TestViewer(props: any) {
34-
const { children, isDataGridTest, isDataGridPivotTest, path } = props;
34+
const { children, isDataGridTest, isDataGridPivotTest, isChartTest, path } = props;
3535

3636
return (
3737
<React.Fragment>
@@ -61,7 +61,7 @@ function TestViewer(props: any) {
6161
},
6262
}}
6363
/>
64-
<MockTime isDataGridTest={isDataGridTest}>
64+
<MockTime shouldAdvanceTime={isDataGridTest || isChartTest}>
6565
<LoadFont
6666
isDataGridTest={isDataGridTest}
6767
isDataGridPivotTest={isDataGridPivotTest}
@@ -74,14 +74,14 @@ function TestViewer(props: any) {
7474
);
7575
}
7676

77-
function MockTime(props: any) {
77+
function MockTime(props: React.PropsWithChildren<{ shouldAdvanceTime: boolean }>) {
7878
const [ready, setReady] = React.useState(false);
7979

8080
React.useEffect(() => {
81-
const dispose = setupFakeClock(props.isDataGridTest);
81+
const dispose = setupFakeClock(props.shouldAdvanceTime);
8282
setReady(true);
8383
return dispose;
84-
}, [props.isDataGridTest]);
84+
}, [props.shouldAdvanceTime]);
8585

8686
return ready ? props.children : null;
8787
}

test/regressions/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ function App() {
9494
path: '/',
9595
element: <Root />,
9696
children: Object.keys(testsBySuite).map((suite) => {
97+
const isChartTest = suite.startsWith('docs-charts');
9798
const isDataGridTest =
98-
suite.indexOf('docs-data-grid') === 0 || suite === 'test-regressions-data-grid';
99+
suite.startsWith('docs-data-grid') || suite === 'test-regressions-data-grid';
99100
const isDataGridPivotTest = isDataGridTest && suite.startsWith('docs-data-grid-pivoting');
100101
return {
101102
path: suite,
@@ -105,6 +106,7 @@ function App() {
105106
<TestViewer
106107
isDataGridTest={isDataGridTest}
107108
isDataGridPivotTest={isDataGridPivotTest}
109+
isChartTest={isChartTest}
108110
path={computePath(test)}
109111
>
110112
<test.case />

0 commit comments

Comments
 (0)