Skip to content

Commit ef52b8c

Browse files
committed
add box/violin ax-rng test from "width" changes on visible restyle
1 parent a237252 commit ef52b8c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: test/jasmine/tests/box_test.js

+32
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,36 @@ describe('Test box restyle:', function() {
463463
.catch(failTest)
464464
.then(done);
465465
});
466+
467+
it('should be able to change axis range when the number of distinct positions changes', function(done) {
468+
function _assert(msg, xrng, yrng) {
469+
var fullLayout = gd._fullLayout;
470+
expect(fullLayout.xaxis.range).toBeCloseToArray(xrng, 2, msg + ' xrng');
471+
expect(fullLayout.yaxis.range).toBeCloseToArray(yrng, 2, msg + ' yrng');
472+
}
473+
474+
Plotly.plot(gd, [{
475+
type: 'box',
476+
width: 0.4,
477+
y: [0, 5, 7, 8],
478+
y0: 0
479+
}, {
480+
type: 'box',
481+
y: [0, 5, 7, 8],
482+
y0: 0.1
483+
}])
484+
.then(function() {
485+
_assert('base', [-0.2, 1.5], [-0.444, 8.444]);
486+
return Plotly.restyle(gd, 'visible', [true, 'legendonly']);
487+
})
488+
.then(function() {
489+
_assert('only trace0 visible', [-0.2, 0.2], [-0.444, 8.444]);
490+
return Plotly.restyle(gd, 'visible', ['legendonly', true]);
491+
})
492+
.then(function() {
493+
_assert('only trace1 visible', [-0.5, 0.5], [-0.444, 8.444]);
494+
})
495+
.catch(failTest)
496+
.then(done);
497+
});
466498
});

0 commit comments

Comments
 (0)