File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,10 @@ function findAccessToken(gd, mapboxIds) {
270270}
271271
272272function isMapboxStyle ( s ) {
273- return typeof s === 'string' && constants . styleValuesMapbox . indexOf ( s ) !== - 1 ;
273+ return typeof s === 'string' && (
274+ constants . styleValuesMapbox . indexOf ( s ) !== - 1 ||
275+ s . indexOf ( 'mapbox://' ) === 0
276+ ) ;
274277}
275278
276279exports . updateFx = function ( gd ) {
Original file line number Diff line number Diff line change @@ -399,6 +399,27 @@ describe('mapbox credentials', function() {
399399 } ) ;
400400 } , LONG_TIMEOUT_INTERVAL ) ;
401401
402+ it ( '@gl should not throw when using a custom mapbox style URL with an access token in the layout' , function ( done ) {
403+ var cnt = 0 ;
404+
405+ Plotly . plot ( gd , [ {
406+ type : 'scattermapbox' ,
407+ lon : [ 10 , 20 , 30 ] ,
408+ lat : [ 10 , 20 , 30 ]
409+ } ] , {
410+ mapbox : {
411+ accesstoken : MAPBOX_ACCESS_TOKEN ,
412+ style : 'mapbox://styles/etpinard/cip93fm98000sbmnuednknloo'
413+ }
414+ } ) . catch ( function ( ) {
415+ cnt ++ ;
416+ } ) . then ( function ( ) {
417+ expect ( cnt ) . toEqual ( 0 ) ;
418+ expect ( gd . _fullLayout . mapbox . accesstoken ) . toBe ( MAPBOX_ACCESS_TOKEN ) ;
419+ done ( ) ;
420+ } ) ;
421+ } , LONG_TIMEOUT_INTERVAL ) ;
422+
402423 it ( '@gl should log when an access token is set while using a custom non-mapbox style' , function ( done ) {
403424 spyOn ( Lib , 'log' ) ;
404425 var cnt = 0 ;
You can’t perform that action at this time.
0 commit comments