-
Notifications
You must be signed in to change notification settings - Fork 828
/
custom-svg-series-tests.js
112 lines (107 loc) · 3.15 KB
/
custom-svg-series-tests.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import test from 'tape';
import React from 'react';
import {mount} from 'enzyme';
import CustomSVGSeries from 'plot/series/custom-svg-series';
import {testRenderWithProps, GENERIC_XYPLOT_SERIES_PROPS} from '../test-utils';
import CustomSVGExample from '../../../showcase/plot/custom-svg-example';
import CustomSVGAllTheMarks from '../../../showcase/plot/custom-svg-all-the-marks';
import CustomSVGRootLevelComponent from '../../../showcase/plot/custom-svg-root-level';
testRenderWithProps(CustomSVGSeries, GENERIC_XYPLOT_SERIES_PROPS);
test('CustomSVGSeries: Showcase Example - CustomSVGExample', t => {
const $ = mount(<CustomSVGExample />);
t.equal(
$.text(),
'1.01.52.02.53.068101214x: 187.5y: 200',
'should fine the right text content'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg').length,
5,
'should find the right number of gs'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg polygon').length,
0,
'should find the right number of polygons'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg circle').length,
2,
'should find the right number of circle'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg rect').length,
3,
'should find the right number of rects'
);
t.end();
});
test('CustomSVGSeries: Showcase Example - CustomSVGRootLevelComponent', t => {
const $ = mount(<CustomSVGRootLevelComponent />);
t.equal(
$.text(),
'1.01.52.02.53.068101214x: 0y: 125x: 87.5y: 75.00000000000001x: 125y: 250x: 250y: 0x: 187.5y: 200',
'should fine the right text content'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg').length,
5,
'should find the right number of gs'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg polygon').length,
0,
'should find the right number of polygons'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg circle').length,
5,
'should find the right number of circle'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg rect').length,
0,
'should find the right number of rects'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg text').length,
5,
'should find the right number of texts'
);
t.end();
});
test('CustomSVGSeries: Showcase Example - CustomSVGAllTheMarks', t => {
const textContent = 'REVERSE0123402468101214';
const hoverText = 'star';
const $ = mount(<CustomSVGAllTheMarks />);
t.equal($.text(), textContent, 'should fine the right text content');
$.find('.rv-xy-plot__series--custom-svg')
.at(0)
.simulate('mouseEnter');
t.equal(
$.text(),
`${textContent}${hoverText}`,
'should fine the right text content on hover'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg').length,
20,
'should find the right number of gs'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg polygon').length,
10,
'should find the right number of polygons'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg circle').length,
5,
'should find the right number of circle'
);
t.equal(
$.find('.rv-xy-plot__series--custom-svg rect').length,
5,
'should find the right number of rects'
);
t.end();
});