File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,39 @@ describe('Test gl plot interactions', function() {
331
331
332
332
} , MODEBAR_DELAY ) ;
333
333
} ) ;
334
+
335
+ it ( 'should be able to toggle visibility' , function ( done ) {
336
+ var OBJECT_PER_TRACE = 5 ;
337
+
338
+ var objects = function ( ) {
339
+ return gd . _fullLayout . _plots . xy . _scene2d . glplot . objects ;
340
+ } ;
341
+
342
+ expect ( objects ( ) . length ) . toEqual ( OBJECT_PER_TRACE ) ;
343
+
344
+ Plotly . restyle ( gd , 'visible' , 'legendonly' ) . then ( function ( ) {
345
+ expect ( objects ( ) . length ) . toEqual ( OBJECT_PER_TRACE ) ;
346
+ expect ( objects ( ) [ 0 ] . data . length ) . toEqual ( 0 ) ;
347
+
348
+ return Plotly . restyle ( gd , 'visible' , true ) ;
349
+ } )
350
+ . then ( function ( ) {
351
+ expect ( objects ( ) . length ) . toEqual ( OBJECT_PER_TRACE ) ;
352
+ expect ( objects ( ) [ 0 ] . data . length ) . not . toEqual ( 0 ) ;
353
+
354
+ return Plotly . restyle ( gd , 'visible' , false ) ;
355
+ } )
356
+ . then ( function ( ) {
357
+ expect ( gd . _fullLayout . _plots . xy . _scene2d ) . toBeUndefined ( ) ;
358
+
359
+ return Plotly . restyle ( gd , 'visible' , true ) ;
360
+ } )
361
+ . then ( function ( ) {
362
+ expect ( objects ( ) . length ) . toEqual ( OBJECT_PER_TRACE ) ;
363
+ expect ( objects ( ) [ 0 ] . data . length ) . not . toEqual ( 0 ) ;
364
+ } )
365
+ . then ( done ) ;
366
+ } ) ;
334
367
} ) ;
335
368
336
369
describe ( 'gl3d event handlers' , function ( ) {
You can’t perform that action at this time.
0 commit comments