Skip to content

Commit 6947b9d

Browse files
authored
test: add not animated styles to disable animations in charts tests (#9916)
1 parent fe6c23c commit 6947b9d

File tree

2 files changed

+123
-11
lines changed

2 files changed

+123
-11
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin';
2+
3+
registerStyles(
4+
'vaadin-chart',
5+
css`
6+
:where([styled-mode]) .highcharts-point {
7+
transition: none;
8+
}
9+
10+
:where([styled-mode]) .highcharts-credits {
11+
transition: none;
12+
}
13+
14+
/* Tooltip */
15+
:where([styled-mode]) .highcharts-tooltip {
16+
transition: none;
17+
}
18+
19+
:where([styled-mode]) .highcharts-point-inactive {
20+
transition: none;
21+
}
22+
23+
:where([styled-mode]) .highcharts-series-inactive {
24+
transition: none;
25+
}
26+
27+
:where([styled-mode]) .highcharts-state-hover path {
28+
transition: none;
29+
}
30+
31+
:where([styled-mode]) .highcharts-state-normal path {
32+
transition: none;
33+
}
34+
35+
/* Legend hover affects points and series */
36+
:where([styled-mode]) g.highcharts-series,
37+
:where([styled-mode]) .highcharts-point,
38+
:where([styled-mode]) .highcharts-markers,
39+
:where([styled-mode]) .highcharts-data-labels {
40+
transition: none;
41+
}
42+
43+
:where([styled-mode]) .highcharts-column-series .highcharts-point {
44+
transition: none;
45+
}
46+
47+
:where([styled-mode]) .highcharts-column-series .highcharts-point-hover {
48+
transition: none;
49+
}
50+
51+
:where([styled-mode]) .highcharts-pie-series .highcharts-point-hover {
52+
transition: none;
53+
}
54+
55+
:where([styled-mode]) .highcharts-funnel-series .highcharts-point-hover {
56+
transition: none;
57+
}
58+
59+
:where([styled-mode]) .highcharts-pyramid-series .highcharts-point-hover {
60+
transition: none;
61+
}
62+
63+
:where([styled-mode]) .highcharts-treemap-series .highcharts-point {
64+
transition: none;
65+
}
66+
67+
:where([styled-mode]) .highcharts-treemap-series .highcharts-point-hover {
68+
transition: none;
69+
}
70+
71+
:where([styled-mode]) .highcharts-legend-item-hidden * {
72+
transition: none;
73+
}
74+
75+
/* Loading */
76+
:where([styled-mode]) .highcharts-loading {
77+
transition: none;
78+
}
79+
80+
:where([styled-mode]) .highcharts-loading-hidden {
81+
transition: none;
82+
}
83+
84+
:where([styled-mode]) .highcharts-sankey-series .highcharts-link {
85+
transition: none;
86+
}
87+
88+
:where([styled-mode]) .highcharts-sankey-series .highcharts-point-hover.highcharts-link {
89+
transition: none;
90+
}
91+
92+
:where([styled-mode]) .highcharts-venn-series .highcharts-point {
93+
transition: none;
94+
}
95+
96+
:where([styled-mode]) .highcharts-button {
97+
transition: none;
98+
}
99+
100+
:where([styled-mode]) .highcharts-button-hover {
101+
transition: none;
102+
}
103+
104+
:where([styled-mode]) .highcharts-range-input:hover rect {
105+
transition: none;
106+
}
107+
108+
:where([styled-mode]) .highcharts-flags-series .highcharts-point .highcharts-label-box {
109+
transition: none;
110+
}
111+
112+
:where([styled-mode]) .highcharts-menu-item {
113+
transition: none;
114+
}
115+
`,
116+
);

packages/charts/test/chart-series.test.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect } from '@vaadin/chai-plugins';
2-
import { aTimeout, fixtureSync, nextRender, oneEvent } from '@vaadin/testing-helpers';
2+
import { fixtureSync, oneEvent } from '@vaadin/testing-helpers';
33
import sinon from 'sinon';
4+
import './chart-not-animated-styles.js';
45
import '../src/vaadin-chart.js';
56

67
describe('vaadin-chart-series', () => {
@@ -93,37 +94,32 @@ describe('vaadin-chart-series', () => {
9394
series = chart.querySelector('vaadin-chart-series');
9495
});
9596

96-
it('should have markers by default for widespread data', async () => {
97+
it('should have markers by default for widespread data', () => {
9798
series.values = [10, 20, 10, 30, 50];
98-
await nextRender();
9999
expect(markersVisible(chartContainer)).to.be.true;
100100
});
101101

102-
it('should not have markers by default for dense data', async () => {
102+
it('should not have markers by default for dense data', () => {
103103
series.values = new Array(400).fill(10);
104-
await nextRender();
105104
expect(markersVisible(chartContainer)).to.be.false;
106105
});
107106

108-
it('should have markers when set to shown', async () => {
107+
it('should have markers when set to shown', () => {
109108
series.markers = 'shown';
110109
series.values = new Array(400).fill(10);
111-
await nextRender();
112110
expect(markersVisible(chartContainer)).to.be.true;
113111
});
114112

115-
it('should not have markers when set to hidden', async () => {
113+
it('should not have markers when set to hidden', () => {
116114
series.markers = 'hidden';
117115
series.values = [10, 20, 10, 30, 50];
118-
await nextRender();
119116
expect(markersVisible(chartContainer)).to.be.false;
120117
});
121118

122119
it('should not have markers when options are set', async () => {
123120
series.values = [10, 20, 10, 30, 50];
124-
await nextRender();
125121
chart.additionalOptions = { plotOptions: { series: { marker: { enabled: false } } } };
126-
await aTimeout(50);
122+
await oneEvent(chart, 'chart-redraw');
127123
expect(markersVisible(chartContainer)).to.be.false;
128124
});
129125
});

0 commit comments

Comments
 (0)