@@ -653,7 +653,7 @@ describe('filter transforms calc:', function() {
653
653
expect ( out [ 0 ] . transforms [ 0 ] . target ) . toEqual ( [ 'b' , 'b' , 'b' ] ) ;
654
654
} ) ;
655
655
656
- it ( 'with categorical items and *<* & *>=*' , function ( ) {
656
+ it ( 'with categorical items and *<* and *>=*' , function ( ) {
657
657
var out = _transform ( [ {
658
658
x : [ 1 , 2 , 3 ] ,
659
659
y : [ 10 , 20 , 30 ] ,
@@ -683,6 +683,62 @@ describe('filter transforms calc:', function() {
683
683
expect ( out [ 1 ] . transforms [ 0 ] . target ) . toEqual ( [ 'b' , 'c' ] ) ;
684
684
} ) ;
685
685
686
+ it ( 'with categorical items and *[]*, *][*, *()* and *)(*' , function ( ) {
687
+ var out = _transform ( [ {
688
+ x : [ 1 , 2 , 3 ] ,
689
+ y : [ 10 , 20 , 30 ] ,
690
+ transforms : [ {
691
+ type : 'filter' ,
692
+ operation : '[]' ,
693
+ target : [ 'a' , 'b' , 'c' ] ,
694
+ value : [ 'a' , 'b' ]
695
+ } ]
696
+ } , {
697
+ x : [ 1 , 2 , 3 ] ,
698
+ y : [ 10 , 20 , 30 ] ,
699
+ transforms : [ {
700
+ type : 'filter' ,
701
+ operation : '()' ,
702
+ target : [ 'a' , 'b' , 'c' ] ,
703
+ value : [ 'a' , 'b' ]
704
+ } ]
705
+ } , {
706
+ x : [ 1 , 2 , 3 ] ,
707
+ y : [ 30 , 20 , 10 ] ,
708
+ transforms : [ {
709
+ type : 'filter' ,
710
+ operation : '][' ,
711
+ target : [ 'a' , 'b' , 'c' ] ,
712
+ value : [ 'a' , 'b' ]
713
+ } ]
714
+ } , {
715
+ x : [ 1 , 2 , 3 ] ,
716
+ y : [ 30 , 20 , 10 ] ,
717
+ transforms : [ {
718
+ type : 'filter' ,
719
+ operation : ')(' ,
720
+ target : [ 'a' , 'b' , 'c' ] ,
721
+ value : [ 'a' , 'b' ]
722
+ } ]
723
+ } ] ) ;
724
+
725
+ expect ( out [ 0 ] . x ) . toEqual ( [ 1 , 2 ] ) ;
726
+ expect ( out [ 0 ] . y ) . toEqual ( [ 10 , 20 ] ) ;
727
+ expect ( out [ 0 ] . transforms [ 0 ] . target ) . toEqual ( [ 'a' , 'b' ] ) ;
728
+
729
+ expect ( out [ 1 ] . x ) . toEqual ( [ ] ) ;
730
+ expect ( out [ 1 ] . y ) . toEqual ( [ ] ) ;
731
+ expect ( out [ 1 ] . transforms [ 0 ] . target ) . toEqual ( [ ] ) ;
732
+
733
+ expect ( out [ 2 ] . x ) . toEqual ( [ 1 , 2 , 3 ] ) ;
734
+ expect ( out [ 2 ] . y ) . toEqual ( [ 30 , 20 , 10 ] ) ;
735
+ expect ( out [ 2 ] . transforms [ 0 ] . target ) . toEqual ( [ 'a' , 'b' , 'c' ] ) ;
736
+
737
+ expect ( out [ 3 ] . x ) . toEqual ( [ 3 ] ) ;
738
+ expect ( out [ 3 ] . y ) . toEqual ( [ 10 ] ) ;
739
+ expect ( out [ 3 ] . transforms [ 0 ] . target ) . toEqual ( [ 'c' ] ) ;
740
+ } ) ;
741
+
686
742
it ( 'with dates items' , function ( ) {
687
743
var out = _transform ( [ Lib . extendDeep ( { } , _base , {
688
744
transforms : [ {
0 commit comments