@@ -847,6 +847,7 @@ describe('filter transforms interactions', function() {
847847 var mockData0 = [ {
848848 x : [ - 2 , - 1 , - 2 , 0 , 1 , 2 , 3 ] ,
849849 y : [ 1 , 2 , 3 , 1 , 2 , 3 , 1 ] ,
850+ text : [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' ] ,
850851 transforms : [ {
851852 type : 'filter' ,
852853 operation : '>'
@@ -856,6 +857,7 @@ describe('filter transforms interactions', function() {
856857 var mockData1 = [ Lib . extendDeep ( { } , mockData0 [ 0 ] ) , {
857858 x : [ 20 , 11 , 12 , 0 , 1 , 2 , 3 ] ,
858859 y : [ 1 , 2 , 3 , 2 , 5 , 2 , 0 ] ,
860+ text : [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' ] ,
859861 transforms : [ {
860862 type : 'filter' ,
861863 operation : '<' ,
@@ -988,4 +990,30 @@ describe('filter transforms interactions', function() {
988990 done ( ) ;
989991 } ) ;
990992 } ) ;
993+
994+ it ( 'zooming in/out should not change filtered data' , function ( done ) {
995+ var data = Lib . extendDeep ( [ ] , mockData1 ) ;
996+
997+ var gd = createGraphDiv ( ) ;
998+
999+ function getTx ( p ) { return p . tx ; }
1000+
1001+ Plotly . plot ( gd , data ) . then ( function ( ) {
1002+ expect ( gd . calcdata [ 0 ] . map ( getTx ) ) . toEqual ( [ 'e' , 'f' , 'g' ] ) ;
1003+ expect ( gd . calcdata [ 1 ] . map ( getTx ) ) . toEqual ( [ 'D' , 'E' , 'F' , 'G' ] ) ;
1004+
1005+ return Plotly . relayout ( gd , 'xaxis.range' , [ - 1 , 1 ] ) ;
1006+ } )
1007+ . then ( function ( ) {
1008+ expect ( gd . calcdata [ 0 ] . map ( getTx ) ) . toEqual ( [ 'e' , 'f' , 'g' ] ) ;
1009+ expect ( gd . calcdata [ 1 ] . map ( getTx ) ) . toEqual ( [ 'D' , 'E' , 'F' , 'G' ] ) ;
1010+
1011+ return Plotly . relayout ( gd , 'xaxis.autorange' , true ) ;
1012+ } )
1013+ . then ( function ( ) {
1014+ expect ( gd . calcdata [ 0 ] . map ( getTx ) ) . toEqual ( [ 'e' , 'f' , 'g' ] ) ;
1015+ expect ( gd . calcdata [ 1 ] . map ( getTx ) ) . toEqual ( [ 'D' , 'E' , 'F' , 'G' ] ) ;
1016+ } )
1017+ . then ( done ) ;
1018+ } ) ;
9911019} ) ;
0 commit comments