1
1
describe ( 'c3 chart shape line' , function ( ) {
2
2
'use strict' ;
3
3
4
+
5
+
4
6
var chart , args ;
5
7
6
8
beforeEach ( function ( done ) {
@@ -21,6 +23,16 @@ describe('c3 chart shape line', function () {
21
23
}
22
24
} ;
23
25
expect ( true ) . toBeTruthy ( ) ;
26
+
27
+ } ) ;
28
+
29
+ it ( "Should render the lines correctly" , function ( done ) {
30
+ setTimeout ( function ( ) {
31
+ var target = chart . internal . main . select ( '.c3-chart-line.c3-target-data1' ) ;
32
+ var commands = parseSvgPath ( target . select ( '.c3-line-data1' ) . attr ( 'd' ) ) ;
33
+ expect ( commands . length ) . toBe ( 6 ) ;
34
+ done ( ) ;
35
+ } , 500 ) ;
24
36
} ) ;
25
37
26
38
it ( "should not have shape-rendering when it's line chart" , function ( ) {
@@ -79,30 +91,43 @@ describe('c3 chart shape line', function () {
79
91
} , 500 ) ;
80
92
} ) ;
81
93
82
- it ( 'should change args to include null data on scatter plot' , function ( ) {
83
- args = {
84
- data : {
85
- columns : [
86
- [ 'data1' , 30 , null , 100 , 400 , - 150 , 250 ] ,
87
- [ 'data2' , 50 , 20 , 10 , 40 , 15 , 25 ] ,
88
- [ 'data3' , - 150 , 120 , 110 , 140 , 115 , 125 ]
89
- ] ,
90
- type : 'scatter'
91
- }
92
- } ;
93
- expect ( true ) . toBeTruthy ( ) ;
94
- } ) ;
95
-
96
- it ( 'should not show the circle for null' , function ( done ) {
94
+ it ( 'should not draw a line segment for null data' , function ( done ) {
97
95
setTimeout ( function ( ) {
98
96
var target = chart . internal . main . select ( '.c3-chart-line.c3-target-data1' ) ;
99
- expect ( + target . select ( '.c3-circle-0' ) . style ( 'opacity' ) ) . toBe ( 0.5 ) ;
100
- expect ( + target . select ( '.c3-circle-1' ) . style ( 'opacity' ) ) . toBe ( 0 ) ;
101
- expect ( + target . select ( '.c3-circle-2' ) . style ( 'opacity' ) ) . toBe ( 0.5 ) ;
97
+ var commands = parseSvgPath ( target . select ( '.c3-line-data1' ) . attr ( 'd' ) ) ;
98
+ var segments = 0 ;
99
+ for ( var i = 0 ; i < commands . length ; i ++ ) {
100
+ ( commands [ i ] . command == 'L' ) ? segments ++ : null ;
101
+ }
102
+ expect ( segments ) . toBe ( 3 ) ;
102
103
done ( ) ;
103
104
} , 500 ) ;
104
105
} ) ;
105
106
107
+ // it('should change args to include null data on scatter plot', function () {
108
+ // args = {
109
+ // data: {
110
+ // columns: [
111
+ // ['data1', 30, null, 100, 400, -150, 250],
112
+ // ['data2', 50, 20, 10, 40, 15, 25],
113
+ // ['data3', -150, 120, 110, 140, 115, 125]
114
+ // ],
115
+ // type: 'scatter'
116
+ // }
117
+ // };
118
+ // expect(true).toBeTruthy();
119
+ // });
120
+
121
+ // it('should not show the circle for null', function (done) {
122
+ // setTimeout(function () {
123
+ // var target = chart.internal.main.select('.c3-chart-line.c3-target-data1');
124
+ // expect(+target.select('.c3-circle-0').style('opacity')).toBe(0.5);
125
+ // expect(+target.select('.c3-circle-1').style('opacity')).toBe(0);
126
+ // expect(+target.select('.c3-circle-2').style('opacity')).toBe(0.5);
127
+ // done();
128
+ // }, 500);
129
+ // });
130
+
106
131
} ) ;
107
132
108
133
describe ( 'spline.interpolation option' , function ( ) {
@@ -123,6 +148,7 @@ describe('c3 chart shape line', function () {
123
148
}
124
149
}
125
150
} ;
151
+
126
152
expect ( true ) . toBeTruthy ( ) ;
127
153
} ) ;
128
154
0 commit comments