@@ -745,7 +745,7 @@ describe('supplyDefaults with groupby + filter', function() {
745745 return gd . calcdata . map ( calcDatatoTrace ) ;
746746 }
747747
748- it ( 'computes the correct data when filter target blank ' , function ( ) {
748+ it ( 'filter + groupby with blank target' , function ( ) {
749749 var out = _transform ( [ {
750750 x : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ,
751751 y : [ 4 , 6 , 5 , 7 , 6 , 8 , 9 ] ,
@@ -766,7 +766,7 @@ describe('supplyDefaults with groupby + filter', function() {
766766 expect ( out [ 1 ] . y ) . toEqual ( [ 7 , 6 , 8 ] ) ;
767767 } ) ;
768768
769- it ( 'computes the correct data when fiter + groupby' , function ( ) {
769+ it ( 'fiter + groupby' , function ( ) {
770770 var out = _transform ( [ {
771771 x : [ 5 , 4 , 3 ] ,
772772 y : [ 6 , 5 , 4 ] ,
@@ -794,7 +794,7 @@ describe('supplyDefaults with groupby + filter', function() {
794794 expect ( out [ 2 ] . y ) . toEqual ( [ 7 , 8 , 9 ] ) ;
795795 } ) ;
796796
797- it ( 'computes the correct data when groupby + filter' , function ( ) {
797+ it ( 'groupby + filter' , function ( ) {
798798 var out = _transform ( [ {
799799 x : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ,
800800 y : [ 4 , 6 , 5 , 7 , 6 , 8 , 9 ] ,
@@ -816,7 +816,7 @@ describe('supplyDefaults with groupby + filter', function() {
816816 expect ( out [ 1 ] . y ) . toEqual ( [ 7 , 6 , 8 ] ) ;
817817 } ) ;
818818
819- it ( 'computes the correct data when groupby + groupby' , function ( ) {
819+ it ( 'groupby + groupby' , function ( ) {
820820 var out = _transform ( [ {
821821 x : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ,
822822 y : [ 4 , 6 , 5 , 7 , 6 , 8 , 9 , 10 ] ,
@@ -839,4 +839,33 @@ describe('supplyDefaults with groupby + filter', function() {
839839 expect ( out [ 3 ] . x ) . toEqual ( [ 6 ] ) ;
840840 expect ( out [ 4 ] . x ) . toEqual ( [ 8 ] ) ;
841841 } ) ;
842+
843+ it ( 'groupby + groupby + filter' , function ( ) {
844+ var out = _transform ( [ {
845+ x : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ,
846+ y : [ 4 , 6 , 5 , 7 , 6 , 8 , 9 , 10 ] ,
847+ transforms : [ {
848+ type : 'groupby' ,
849+ groups : [ 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 ]
850+ } , {
851+ type : 'groupby' ,
852+ groups : [ 3 , 4 , 3 , 4 , 3 , 4 , 3 , 5 ] ,
853+ } , {
854+ type : 'filter' ,
855+ target : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ,
856+ operation : '<' ,
857+ value : 4.5
858+ } ]
859+ } ] ) ;
860+ // | | | | | | | |
861+ // v v v v v v v v
862+ // Trace number: 0 1 0 1 2 3 2 4
863+
864+ expect ( out . length ) . toEqual ( 5 ) ;
865+ expect ( out [ 0 ] . x ) . toEqual ( [ 1 , 3 ] ) ;
866+ expect ( out [ 1 ] . x ) . toEqual ( [ 2 , 4 ] ) ;
867+ expect ( out [ 2 ] . x ) . toEqual ( [ ] ) ;
868+ expect ( out [ 3 ] . x ) . toEqual ( [ ] ) ;
869+ expect ( out [ 4 ] . x ) . toEqual ( [ ] ) ;
870+ } ) ;
842871} ) ;
0 commit comments