File tree 1 file changed +36
-0
lines changed
Filter options
1 file changed +36
-0
lines changed
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ describe('sankey tests', function() {
112
112
expect ( fullTrace . link . target )
113
113
. toEqual ( [ ] , 'presence of link target array is guaranteed' ) ;
114
114
115
+ expect ( fullTrace . link . label )
116
+ . toEqual ( [ ] , 'presence of link target array is guaranteed' ) ;
115
117
} ) ;
116
118
117
119
it ( '\'Sankey\' specification should have proper types' ,
@@ -179,6 +181,40 @@ describe('sankey tests', function() {
179
181
180
182
} ) ;
181
183
184
+ it ( 'fills \'link\' labels if not specified' , function ( ) {
185
+
186
+ var fullTrace = _supply ( {
187
+ node : {
188
+ label : [ 'a' , 'b' ]
189
+ } ,
190
+ link : {
191
+ source : [ 0 , 1 ] ,
192
+ target : [ 1 , 0 ] ,
193
+ value : [ 1 , 2 ]
194
+ }
195
+ } ) ;
196
+
197
+ expect ( Lib . isArray ( fullTrace . link . label ) ) . toBe ( true , 'must be an array' ) ;
198
+ expect ( fullTrace . link . label ) . toEqual ( [ '' , '' ] , 'an array of empty strings' ) ;
199
+ } ) ;
200
+
201
+ it ( 'preserves \'link\' labels if specified' , function ( ) {
202
+
203
+ var fullTrace = _supply ( {
204
+ node : {
205
+ label : [ 'a' , 'b' ]
206
+ } ,
207
+ link : {
208
+ source : [ 0 , 1 ] ,
209
+ target : [ 1 , 0 ] ,
210
+ value : [ 1 , 2 ] ,
211
+ label : [ 'a' , 'b' ]
212
+ }
213
+ } ) ;
214
+
215
+ expect ( Lib . isArray ( fullTrace . link . label ) ) . toBe ( true , 'must be an array' ) ;
216
+ expect ( fullTrace . link . label ) . toEqual ( [ 'a' , 'b' ] , 'an array of the supplied values' ) ;
217
+ } ) ;
182
218
} ) ;
183
219
184
220
describe ( 'sankey calc' , function ( ) {
You can’t perform that action at this time.
0 commit comments