forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChartAxis.test.tsx
More file actions
57 lines (55 loc) · 1.6 KB
/
ChartAxis.test.tsx
File metadata and controls
57 lines (55 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { render } from '@testing-library/react';
import { Chart } from '../Chart/Chart';
import { ChartGroup } from '../ChartGroup/ChartGroup';
import { ChartLine } from '../ChartLine/ChartLine';
import { ChartLabel } from '../ChartLabel/ChartLabel';
import { ChartAxis } from './ChartAxis';
Object.values([true, false]).forEach(() => {
test('ChartAxis', () => {
const { asFragment } = render(<ChartAxis tickLabelComponent={<ChartLabel id="test" />} />);
expect(asFragment()).toMatchSnapshot();
});
});
test('renders component data', () => {
const { asFragment } = render(
<Chart domainPadding={{ x: [30, 25] }} height={200} width={300}>
<ChartGroup>
<ChartLine
data={[
{ x: 1, y: 1 },
{ x: 2, y: 2 },
{ x: 3, y: 5 },
{ x: 4, y: 3 }
]}
/>
<ChartLine
data={[
{ x: 1, y: 2 },
{ x: 2, y: 1 },
{ x: 3, y: 7 },
{ x: 4, y: 4 }
]}
/>
<ChartLine
data={[
{ x: 1, y: 3 },
{ x: 2, y: 4 },
{ x: 3, y: 9 },
{ x: 4, y: 5 }
]}
/>
<ChartLine
data={[
{ x: 1, y: 3 },
{ x: 2, y: 3 },
{ x: 3, y: 8 },
{ x: 4, y: 7 }
]}
/>
</ChartGroup>
<ChartAxis tickValues={[2, 3, 4]} tickLabelComponent={<ChartLabel id="test" />} />
<ChartAxis dependentAxis tickValues={[2, 5, 8]} tickLabelComponent={<ChartLabel id="test2" />} />
</Chart>
);
expect(asFragment()).toMatchSnapshot();
});