@@ -268,6 +268,28 @@ describe('Test sunburst calc:', function() {
268268 expect ( Lib . warn ) . toHaveBeenCalledTimes ( 1 ) ;
269269 expect ( Lib . warn ) . toHaveBeenCalledWith ( 'Failed to build sunburst hierarchy. Error: ambiguous: b' ) ;
270270 } ) ;
271+
272+ it ( 'should accept numbers (even `0`) are ids/parents items' , function ( ) {
273+ _calc ( {
274+ labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
275+ ids : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ,
276+ parents : [ '' , 0 , 0 , 2 , 2 , 0 , 0 , 6 , 0 ]
277+ } ) ;
278+
279+ expect ( extract ( 'id' ) ) . toEqual ( [ '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' ] ) ;
280+ expect ( extract ( 'pid' ) ) . toEqual ( [ '' , '0' , '0' , '2' , '2' , '0' , '0' , '6' , '0' ] ) ;
281+ } ) ;
282+
283+ it ( 'should accept mix typed are ids/parents items' , function ( ) {
284+ _calc ( {
285+ labels : [ 'Eve' , 'Cain' , 'Seth' , 'Enos' , 'Noam' , 'Abel' , 'Awan' , 'Enoch' , 'Azura' ] ,
286+ ids : [ true , 1 , '2' , 3 , 4 , 5 , 6 , 7 , 8 ] ,
287+ parents : [ '' , true , true , 2 , 2 , 'true' , 'true' , '6' , true ]
288+ } ) ;
289+
290+ expect ( extract ( 'id' ) ) . toEqual ( [ 'true' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' ] ) ;
291+ expect ( extract ( 'pid' ) ) . toEqual ( [ '' , 'true' , 'true' , '2' , '2' , 'true' , 'true' , '6' , 'true' ] ) ;
292+ } ) ;
271293} ) ;
272294
273295describe ( 'Test sunburst hover:' , function ( ) {
0 commit comments