@@ -502,4 +502,46 @@ describe('@gl Test splom interactions:', function() {
502
502
. catch ( failTest )
503
503
. then ( done ) ;
504
504
} ) ;
505
+
506
+ it ( 'should correctly move axis layers when relayouting *grid.(x|y)side*' , function ( done ) {
507
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/splom_upper-nodiag.json' ) ) ;
508
+
509
+ function _assert ( exp ) {
510
+ var g = d3 . select ( gd ) . select ( 'g.cartesianlayer' ) ;
511
+ for ( var k in exp ) {
512
+ // all ticks are set to same position,
513
+ // only check first one
514
+ var tick0 = g . select ( 'g.' + k + 'tick > text' ) ;
515
+ var pos = { x : 'y' , y : 'x' } [ k . charAt ( 0 ) ] ;
516
+ expect ( + tick0 . attr ( pos ) )
517
+ . toBeWithin ( exp [ k ] , 1 , pos + ' position for axis ' + k ) ;
518
+ }
519
+ }
520
+
521
+ Plotly . plot ( gd , fig ) . then ( function ( ) {
522
+ expect ( gd . _fullLayout . grid . xside ) . toBe ( 'bottom' , 'sanity check dflt grid.xside' ) ;
523
+ expect ( gd . _fullLayout . grid . yside ) . toBe ( 'left' , 'sanity check dflt grid.yside' ) ;
524
+
525
+ _assert ( {
526
+ x : 433 , x2 : 433 , x3 : 433 ,
527
+ y : 80 , y2 : 80 , y3 : 80
528
+ } ) ;
529
+ return Plotly . relayout ( gd , 'grid.yside' , 'left plot' ) ;
530
+ } )
531
+ . then ( function ( ) {
532
+ _assert ( {
533
+ x : 433 , x2 : 433 , x3 : 433 ,
534
+ y : 79 , y2 : 230 , y3 : 382
535
+ } ) ;
536
+ return Plotly . relayout ( gd , 'grid.xside' , 'bottom plot' ) ;
537
+ } )
538
+ . then ( function ( ) {
539
+ _assert ( {
540
+ x : 212 , x2 : 323 , x3 : 433 ,
541
+ y : 79 , y2 : 230 , y3 : 382
542
+ } ) ;
543
+ } )
544
+ . catch ( failTest )
545
+ . then ( done ) ;
546
+ } ) ;
505
547
} ) ;
0 commit comments