8000 fix issue 4844 - bypass non-string ids when matching axes · plotly/plotly.js@45841a8 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45841a8

Browse files
committed
fix issue 4844 - bypass non-string ids when matching axes
1 parent bee2455 commit 45841a8

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/plots/cartesian/axis_ids.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exports.name2id = function name2id(name) {
3131
};
3232

3333
exports.cleanId = function cleanId(id, axLetter) {
34-
if(!id.match(constants.AX_ID_PATTERN)) return;
34+
if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return;
3535
if(axLetter && id.charAt(0) !== axLetter) return;
3636

3737
var axNum = id.substr(1).replace(/^0+/, '');

test/jasmine/tests/axes_test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5576,3 +5576,41 @@ describe('more react tests', function() {
55765576
.then(done);
55775577
});
55785578
});
5579+
5580+
describe('more matching axes tests', function() {
5581+
var gd;
5582+
5583+
beforeEach(function() {
5584+
gd = createGraphDiv();
5585+
});
5586+
5587+
afterEach(destroyGraphDiv);
5588+
5589+
it('should bypass non-string id when matching ids', function(done) {
5590+
Plotly.newPlot(gd, {
5591+
data: [{
5592+
x: [0, 1],
5593+
y: [0, 1]
5594+
}, {
5595+
x: [0, 1],
5596+
y: [1, 2],
5597+
yaxis: 'y2'
5598+
}],
5599+
layout: {
5600+
xaxis: {
5601+
anchor: 'y'
5602+
},
5603+
yaxis: {
5604+
anchor: 'x'
5605+
},
5606+
yaxis2: {
5607+
anchor: [], // bad input
5608+
position: 0.1,
5609+
overlaying: 'y'
5610+
}
5611+
}
5612+
})
5613+
.catch(failTest)
5614+
.then(done);
5615+
});
5616+
});

0 commit comments

Comments
 (0)
0