Skip to content

Commit 3e9d162

Browse files
committed
ensure we create only one modebar-container
1 parent 7495f4c commit 3e9d162

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/plot_api/plot_api.js

+1
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,7 @@ function makePlotFramework(gd) {
38023802
.classed('gl-container', true);
38033803

38043804
fullLayout._paperdiv.selectAll('.main-svg').remove();
3805+
fullLayout._paperdiv.selectAll('.modebar-container').remove();
38053806

38063807
fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child')
38073808
.classed('main-svg', true);

test/jasmine/tests/plot_api_test.js

+17
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,23 @@ describe('Test plot api', function() {
26832683
.catch(failTest)
26842684
.then(done);
26852685
});
2686+
2687+
it('should only have one modebar-container', function(done) {
2688+
var data = [{y: [1, 2]}];
2689+
2690+
Plotly.plot(gd, data).then(function() {
2691+
var modebars = document.getElementsByClassName('modebar-container');
2692+
expect(modebars.length).toBe(1);
2693+
2694+
return Plotly.newPlot(gd, data);
2695+
})
2696+
.then(function() {
2697+
var modebars = document.getElementsByClassName('modebar-container');
2698+
expect(modebars.length).toBe(1);
2699+
})
2700+
.catch(failTest)
2701+
.then(done);
2702+
});
26862703
});
26872704

26882705
describe('Plotly.update should', function() {

0 commit comments

Comments
 (0)