File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ exports.name2id = function name2id(name) {
3131} ;
3232
3333exports . 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 + / , '' ) ;
Original file line number Diff line number Diff 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+ } ) ;
You can’t perform that action at this time.
0 commit comments