Skip to content

Commit 131145d

Browse files
committed
test that changing legend.tracegroupgap updates the margin size
1 parent 0806a9a commit 131145d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/jasmine/tests/legend_test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,34 @@ describe('legend relayout update', function() {
703703
.then(done);
704704
});
705705
});
706+
707+
describe('with legendgroup', function() {
708+
var mock = require('@mocks/legendgroup_horizontal_wrapping.json');
709+
var gd;
710+
711+
beforeEach(function() {
712+
gd = createGraphDiv();
713+
});
714+
afterEach(destroyGraphDiv);
715+
716+
it('changes the margin size to fit tracegroupgap', function(done) {
717+
var mockCopy = Lib.extendDeep({}, mock);
718+
Plotly.newPlot(gd, mockCopy)
719+
.then(function() {
720+
expect(gd._fullLayout._size.b).toBe(130);
721+
return Plotly.relayout(gd, 'legend.tracegroupgap', 70);
722+
})
723+
.then(function() {
724+
expect(gd._fullLayout._size.b).toBe(185);
725+
return Plotly.relayout(gd, 'legend.tracegroupgap', 10);
726+
})
727+
.then(function() {
728+
expect(gd._fullLayout._size.b).toBe(130);
729+
})
730+
.catch(failTest)
731+
.then(done);
732+
});
733+
});
706734
});
707735

708736
describe('legend orientation change:', function() {

0 commit comments

Comments
 (0)