Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/8161_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Do not leak internal `_template` property into input `layout` rangeslider opposing axis containers [[#8161](https://github.com/plotly/plotly.js/pull/8161)]
4 changes: 3 additions & 1 deletion src/plots/cartesian/autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ function doAutoRange(gd, ax, presetRange) {
axeRangeOpts.range = getAutoRange(gd, ax);
}
}
anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts);
var inOpts = Lib.extendFlat({}, axeRangeOpts);
delete inOpts._template;
anchorAx._input.rangeslider[ax._name] = inOpts;
}
}

Expand Down
26 changes: 26 additions & 0 deletions test/jasmine/tests/range_slider_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,32 @@ describe('rangesliders in general', function() {
.then(done, done.fail);
});

it('should not leak _template into input layout rangeslider opp-axis container', function(done) {
Plotly.newPlot(gd, [{ x: [1, 2, 3], y: [1, 2, 3] }], { xaxis: { rangeslider: {} }})
.then(function() {
expect(gd.layout.xaxis.rangeslider.yaxis).toBeDefined();
expect(gd.layout.xaxis.rangeslider.yaxis._template).toBeUndefined();
expect(gd._fullLayout.xaxis.rangeslider.yaxis._template).toBeDefined();
})
.then(done, done.fail);
});

it('should not leak _template into input layout when a template is used', function(done) {
Plotly.newPlot(gd, [{ x: [1, 2, 3], y: [1, 2, 3] }], {
template: {
layout: {
xaxis: { rangeslider: { yaxis: { rangemode: 'auto' } } }
}
},
xaxis: { rangeslider: {} }
})
.then(function() {
expect(gd.layout.xaxis.rangeslider.yaxis).toBeDefined();
expect(gd.layout.xaxis.rangeslider.yaxis._template).toBeUndefined();
})
.then(done, done.fail);
});

it('should plot when only y data is provided', function(done) {
Plotly.newPlot(gd, [{ y: [1, 2, 3] }], { xaxis: { rangeslider: {} }})
.then(function() {
Expand Down