Skip to content

Commit 781f0ea

Browse files
committed
Add WIP Jasmine test -- currently failing
1 parent 9466992 commit 781f0ea

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/jasmine/tests/axes_test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)