@@ -135,6 +135,17 @@ describe("RemoteFigure.changeAxisFeature", function() {
135135 } ) ;
136136} ) ;
137137
138+ describe ( "RemoteFigure.setFeatureFilters" , function ( ) {
139+ it ( 'should write values in axes[0].rubberBand' , function ( ) {
140+ const figure = new RemoteFigure ( data , canvas . width , canvas . height , 100 , 100 , canvas . id ) ;
141+ figure . setCanvas ( canvas . id ) ;
142+ figure . axes [ 0 ] = new Axis ( figure . features . get ( "x" ) , new Rect ( new Vertex ( ) , new Vertex ( 100 , 100 ) ) , new Vertex ( ) , new Vertex ( 100 , 0 ) , "x" , new Vertex ( ) ) ;
143+ figure . setFeatureFilter ( "x" , - 1 , 1.1 ) ;
144+ expect ( figure . selectedIndices . length , "figure.selectedIndices.length" ) . to . be . equal ( 2 ) ;
145+ } ) ;
146+ } ) ;
147+
148+
138149describe ( "RemoteFigure.resizeUpdate" , function ( ) {
139150 it ( "should resize figure" , function ( ) {
140151 const figure = new RemoteFigure ( data , canvas . width , canvas . height , 100 , 100 , canvas . id ) ;
@@ -147,16 +158,6 @@ describe("RemoteFigure.resizeUpdate", function() {
147158 } ) ;
148159} ) ;
149160
150- describe ( "RemoteFigure.resizeWindow" , function ( ) {
151- it ( "should resize figure with new window size" , function ( ) {
152- const figure = new RemoteFigure ( data , canvas . width , canvas . height , 100 , 100 , canvas . id ) ;
153- figure . setCanvas ( canvas . id ) ;
154- figure . resizeWindow ( 700 , 500 ) ;
155- expect ( figure . size . x , "size.x" ) . to . be . equal ( 700 ) ;
156- expect ( figure . size . y , "size.y" ) . to . be . equal ( 500 ) ;
157- } ) ;
158- } ) ;
159-
160161describe ( "RemoteFigure.reset" , function ( ) {
161162 it ( "should reset scales and selectors" , function ( ) {
162163 const figure = new RemoteFigure ( data , canvas . width , canvas . height , 100 , 100 , canvas . id ) ;
@@ -214,6 +215,7 @@ describe("RemoteFigure.mouseListener", function() {
214215 const mouseDown = new MouseEvent ( 'mousedown' , { clientX : 150 , clientY : 150 } ) ;
215216 const mouseMove1 = new MouseEvent ( 'mousemove' , { clientX : 150 , clientY : 150 } ) ;
216217 const mouseMove2 = new MouseEvent ( 'mousemove' , { clientX : 370 , clientY : 520 } ) ;
218+ const mouseMove3 = new MouseEvent ( 'mousemove' , { clientX : 20000 , clientY : 0 } ) ;
217219 const mouseWheel = new WheelEvent ( 'wheel' , { clientX : 150 , clientY : 150 , deltaY : ZOOM_FACTOR } ) ;
218220 const mouseLeave = new MouseEvent ( 'mouseleave' , { } ) ;
219221
@@ -262,6 +264,19 @@ describe("RemoteFigure.mouseListener", function() {
262264 expect ( canvas . style . cursor , "default cursor" ) . to . be . equal ( "default" ) ;
263265 } ) ;
264266
267+ it ( "should preserve rubberBand min and max values" , function ( ) {
268+ figure . axes [ 0 ] . rubberBand . minValue = 0 ;
269+ figure . axes [ 0 ] . rubberBand . maxValue = 200 ;
270+ figure . draw ( ) ;
271+ expect ( figure . axes [ 0 ] . rubberBand . canvasLength , "rubberBand.canvasLength" ) . to . be . closeTo ( 764 , 1. ) ;
272+ canvas . dispatchEvent ( mouseMove1 ) ;
273+ canvas . dispatchEvent ( mouseDown ) ;
274+ canvas . dispatchEvent ( mouseMove3 ) ;
275+ canvas . dispatchEvent ( mouseUp ) ;
276+ expect ( figure . axes [ 0 ] . rubberBand . canvasLength , "rubberBand.canvasLength" ) . to . be . equal ( 0 ) ;
277+ figure . reset ( ) ;
278+ } ) ;
279+
265280 it ( "should translate figure" , function ( ) {
266281 canvas . dispatchEvent ( mouseMove1 ) ;
267282 canvas . dispatchEvent ( mouseDown ) ;
@@ -273,7 +288,7 @@ describe("RemoteFigure.mouseListener", function() {
273288
274289 expect ( figure . translation , "translation" ) . to . deep . equal ( new Vertex ( ) ) ;
275290 } ) ;
276-
291+
277292 it ( "should handle wheel events" , function ( ) {
278293 const minValue0 = figure . axes [ 0 ] . minValue ;
279294 const maxValue0 = figure . axes [ 0 ] . maxValue ;
@@ -295,16 +310,16 @@ describe("RemoteFigure.mouseListener", function() {
295310 const maxValue1 = figure . axes [ 1 ] . maxValue ;
296311
297312 figure . zoomIn ( ) ;
298- expect ( figure . axes [ 0 ] . minValue , "minValue0" ) . to . not . be . equal ( minValue0 ) ;
299- expect ( figure . axes [ 0 ] . maxValue , "maxValue0" ) . to . not . be . equal ( maxValue0 ) ;
300- expect ( figure . axes [ 1 ] . minValue , "minValue0" ) . to . not . be . equal ( minValue1 ) ;
301- expect ( figure . axes [ 1 ] . maxValue , "maxValue1" ) . to . not . be . equal ( maxValue1 ) ;
313+ expect ( figure . axes [ 0 ] . minValue , "minValue0" ) . to . not . be . closeTo ( minValue0 , 0.001 ) ;
314+ expect ( figure . axes [ 0 ] . maxValue , "maxValue0" ) . to . not . be . closeTo ( maxValue0 , 0.001 ) ;
315+ expect ( figure . axes [ 1 ] . minValue , "minValue0" ) . to . not . be . closeTo ( minValue1 , 0.001 ) ;
316+ expect ( figure . axes [ 1 ] . maxValue , "maxValue1" ) . to . not . be . closeTo ( maxValue1 , 0.001 ) ;
302317
303318 figure . zoomOut ( ) ;
304- expect ( figure . axes [ 0 ] . minValue , "minValue0" ) . to . be . equal ( minValue0 ) ;
305- expect ( figure . axes [ 0 ] . maxValue , "maxValue0" ) . to . be . equal ( maxValue0 ) ;
306- expect ( figure . axes [ 1 ] . minValue , "minValue0" ) . to . be . equal ( minValue1 ) ;
307- expect ( figure . axes [ 1 ] . maxValue , "maxValue1" ) . to . be . equal ( maxValue1 ) ;
319+ expect ( figure . axes [ 0 ] . minValue , "minValue0" ) . to . be . closeTo ( minValue0 , 0.001 ) ;
320+ expect ( figure . axes [ 0 ] . maxValue , "maxValue0" ) . to . be . closeTo ( maxValue0 , 0.001 ) ;
321+ expect ( figure . axes [ 1 ] . minValue , "minValue0" ) . to . be . closeTo ( minValue1 , 0.001 ) ;
322+ expect ( figure . axes [ 1 ] . maxValue , "maxValue1" ) . to . be . closeTo ( maxValue1 , 0.001 ) ;
308323 } ) ;
309324
310325 it ( "should reset state correctly on mouseleave" , function ( ) {
0 commit comments