@@ -847,6 +847,7 @@ describe('filter transforms interactions', function() {
847
847
var mockData0 = [ {
848
848
x : [ - 2 , - 1 , - 2 , 0 , 1 , 2 , 3 ] ,
849
849
y : [ 1 , 2 , 3 , 1 , 2 , 3 , 1 ] ,
850
+ text : [ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' ] ,
850
851
transforms : [ {
851
852
type : 'filter' ,
852
853
operation : '>'
@@ -856,6 +857,7 @@ describe('filter transforms interactions', function() {
856
857
var mockData1 = [ Lib . extendDeep ( { } , mockData0 [ 0 ] ) , {
857
858
x : [ 20 , 11 , 12 , 0 , 1 , 2 , 3 ] ,
858
859
y : [ 1 , 2 , 3 , 2 , 5 , 2 , 0 ] ,
860
+ text : [ 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' ] ,
859
861
transforms : [ {
860
862
type : 'filter' ,
861
863
operation : '<' ,
@@ -988,4 +990,30 @@ describe('filter transforms interactions', function() {
988
990
done ( ) ;
989
991
} ) ;
990
992
} ) ;
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
+ } ) ;
991
1019
} ) ;
0 commit comments