@@ -882,6 +882,53 @@ describe('Title automargining', function() {
882882
883883 afterEach ( destroyGraphDiv ) ;
884884
885+ it ( 'keeps cartesian traces aligned with axes when controls also expand margins' , function ( done ) {
886+ Plotly . newPlot ( gd , [ {
887+ x : [ 1 , 2 , 3 ] ,
888+ y : [ 2 , 1 , 3 ] ,
889+ mode : 'lines+markers' ,
890+ line : { simplify : false }
891+ } ] , {
892+ margin : { autoexpand : true , t : 0 } ,
893+ title : {
894+ text : 'Title' ,
895+ automargin : true ,
896+ font : { size : 36 }
897+ } ,
898+ sliders : [ {
899+ pad : { t : 30 } ,
900+ x : 0.05 ,
901+ len : 0.95 ,
902+ steps : [
903+ { label : '0' , method : 'update' , args : [ { } , { } ] } ,
904+ { label : '1' , method : 'update' , args : [ { } , { } ] }
905+ ]
906+ } ] ,
907+ updatemenus : [ {
908+ type : 'buttons' ,
909+ x : 0.05 ,
910+ y : 0 ,
911+ xanchor : 'right' ,
912+ yanchor : 'top' ,
913+ direction : 'left' ,
914+ pad : { t : 60 , r : 20 } ,
915+ buttons : [ { label : 'Play' , method : 'skip' } ]
916+ } ]
917+ } ) . then ( function ( ) {
918+ var plot = d3Select ( gd ) ;
919+ var point = plot . select ( '.scatterlayer .point' ) . node ( ) ;
920+ var yTick ;
921+
922+ plot . selectAll ( '.ytick' ) . each ( function ( ) {
923+ if ( d3Select ( this ) . select ( 'text' ) . text ( ) === '2' ) yTick = this ;
924+ } ) ;
925+
926+ expect ( point ) . not . toBeNull ( ) ;
927+ expect ( yTick ) . toBeDefined ( ) ;
928+ expect ( point . getCTM ( ) . f ) . toBeCloseTo ( yTick . querySelector ( 'text' ) . getCTM ( ) . f , 6 ) ;
929+ } ) . then ( done , done . fail ) ;
930+ } ) ;
931+
885932 it ( 'should avoid overlap with container for yref=paper and allow padding' , function ( done ) {
886933 Plotly . newPlot ( gd , data , {
887934 margin : { t : 0 , b : 0 , l : 0 , r : 0 } ,
0 commit comments