File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -4376,6 +4376,33 @@ describe('Test axes', function() {
43764376 } )
43774377 . then ( done , done . fail ) ;
43784378 } ) ;
4379+ it ( 'should respect axis title placement on relayout' , function ( done ) {
4380+
4381+ function getPos ( gd , sel ) {
4382+ return d3Select ( gd ) . select ( sel ) . node ( ) . getBoundingClientRect ( )
4383+ }
4384+
4385+ function assert_layout ( ) {
4386+ var title_top = getPos ( gd , '.xtitle' ) . top ;
4387+ var tick_bottom = getPos ( gd , '.xtick' ) . bottom ;
4388+ expect ( title_top ) . toBeLessThan ( tick_bottom ) ;
4389+ }
4390+ // TODO: This is failing now.
4391+ // Is it maybe because there's overlap in these elements because of some padding?
4392+ // I'm also not sure that I've accessed the correct properties
4393+ var fig = require ( '@mocks/z-automargin-zoom.json' ) ;
4394+ Plotly . newPlot ( gd , fig )
4395+ . then ( function ( ) {
4396+ assert_layout ( ) ;
4397+ } )
4398+ . then ( function ( ) {
4399+ return Plotly . relayout ( gd , { 'xaxis.range' : [ 6 , 14 ] } ) ;
4400+ } )
4401+ . then ( function ( ) {
4402+ assert_layout ( ) ;
4403+ } )
4404+ . then ( done , done . fail ) ;
4405+ } ) ;
43794406 } ) ;
43804407
43814408 describe ( 'zeroline visibility logic' , function ( ) {
You can’t perform that action at this time.
0 commit comments