@@ -53,6 +53,20 @@ describe('groupby', function() {
5353 } ]
5454 } ] ;
5555
56+ var mockDataWithTypedArrayGroups = [ {
57+ mode : 'markers' ,
58+ x : [ 20 , 11 , 12 , 0 , 1 , 2 , 3 ] ,
59+ y : [ 1 , 2 , 3 , 2 , 5 , 2 , 0 ] ,
60+ transforms : [ {
61+ type : 'groupby' ,
62+ groups : new Uint8Array ( [ 2 , 1 , 2 , 2 , 2 , 1 , 1 ] ) ,
63+ styles : [
64+ { target : 1 , value : { marker : { color : 'green' } } } ,
65+ { target : 2 , value : { marker : { color : 'black' } } }
66+ ]
67+ } ]
68+ } ] ;
69+
5670 afterEach ( destroyGraphDiv ) ;
5771
5872 it ( 'Plotly.plot should plot the transform traces' , function ( done ) {
@@ -318,6 +332,22 @@ describe('groupby', function() {
318332 . catch ( failTest )
319333 . then ( done ) ;
320334 } ) ;
335+
336+ it ( 'Plotly.plot should group points properly using typed array' , function ( done ) {
337+ var data = Lib . extendDeep ( [ ] , mockDataWithTypedArrayGroups ) ;
338+
339+ var gd = createGraphDiv ( ) ;
340+
341+ Plotly . plot ( gd , data ) . then ( function ( ) {
342+ expect ( gd . _fullData . length ) . toEqual ( 2 ) ;
343+ expect ( gd . _fullData [ 0 ] . x ) . toEqual ( [ 20 , 12 , 0 , 1 ] ) ;
344+ expect ( gd . _fullData [ 0 ] . y ) . toEqual ( [ 1 , 3 , 2 , 5 ] ) ;
345+ expect ( gd . _fullData [ 1 ] . x ) . toEqual ( [ 11 , 2 , 3 ] ) ;
346+ expect ( gd . _fullData [ 1 ] . y ) . toEqual ( [ 2 , 2 , 0 ] ) ;
347+ } )
348+ . catch ( failTest )
349+ . then ( done ) ;
350+ } )
321351 } ) ;
322352
323353 describe ( 'many-to-many transforms' , function ( ) {
0 commit comments