File tree 2 files changed +25
-1
lines changed
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) {
270
270
}
271
271
272
272
function 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
+ ) ;
274
277
}
275
278
276
279
exports . updateFx = function ( gd ) {
Original file line number Diff line number Diff line change @@ -399,6 +399,27 @@ describe('mapbox credentials', function() {
399
399
} ) ;
400
400
} , LONG_TIMEOUT_INTERVAL ) ;
401
401
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
+
402
423
it ( '@gl should log when an access token is set while using a custom non-mapbox style' , function ( done ) {
403
424
spyOn ( Lib , 'log' ) ;
404
425
var cnt = 0 ;
You can’t perform that action at this time.
0 commit comments