@@ -1471,12 +1471,26 @@ describe('mapbox plots', function() {
1471
1471
} , LONG_TIMEOUT_INTERVAL ) ;
1472
1472
1473
1473
describe ( 'attributions' , function ( ) {
1474
+ function assertLinks ( s , exp ) {
1475
+ var elements = s [ 0 ] [ 0 ] . getElementsByTagName ( 'a' ) ;
1476
+ expect ( elements . length ) . toEqual ( exp . length ) ;
1477
+ for ( var i = 0 ; i < elements . length ; i ++ ) {
1478
+ var e = elements [ i ] ;
1479
+ expect ( e . href ) . toEqual ( exp [ i ] ) ;
1480
+ expect ( e . target ) . toEqual ( '_blank' ) ;
1481
+ }
1482
+ }
1483
+
1474
1484
it ( '@gl should be displayed for style "Carto"' , function ( done ) {
1475
1485
Plotly . newPlot ( gd , [ { type : 'scattermapbox' } ] , { mapbox : { style : 'carto-darkmatter' } } )
1476
1486
. then ( function ( ) {
1477
1487
var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
1478
1488
expect ( s . size ( ) ) . toBe ( 1 ) ;
1479
1489
expect ( s . text ( ) ) . toEqual ( '© Carto © OpenStreetMap' ) ;
1490
+ assertLinks ( s , [
1491
+ 'https://carto.com/' ,
1492
+ 'https://www.openstreetmap.org/copyright'
1493
+ ] ) ;
1480
1494
} )
1481
1495
. then ( done , done . fail ) ;
1482
1496
} ) ;
@@ -1487,6 +1501,10 @@ describe('mapbox plots', function() {
1487
1501
var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
1488
1502
expect ( s . size ( ) ) . toBe ( 1 ) ;
1489
1503
expect ( s . text ( ) ) . toEqual ( '© Stamen Design LLC © OpenStreetMap' ) ;
1504
+ assertLinks ( s , [
1505
+ 'https://stamen.com/' ,
1506
+ 'https://www.openstreetmap.org/copyright'
1507
+ ] ) ;
1490
1508
} )
1491
1509
. then ( done , done . fail ) ;
1492
1510
} ) ;
@@ -1497,6 +1515,9 @@ describe('mapbox plots', function() {
1497
1515
var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
1498
1516
expect ( s . size ( ) ) . toBe ( 1 ) ;
1499
1517
expect ( s . text ( ) ) . toEqual ( '© OpenStreetMap' ) ;
1518
+ assertLinks ( s , [
1519
+ 'https://www.openstreetmap.org/copyright'
1520
+ ] ) ;
1500
1521
} )
1501
1522
. then ( done , done . fail ) ;
1502
1523
} ) ;
@@ -1507,6 +1528,11 @@ describe('mapbox plots', function() {
1507
1528
var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
1508
1529
expect ( s . size ( ) ) . toBe ( 1 ) ;
1509
1530
expect ( s . text ( ) ) . toEqual ( '© Mapbox © OpenStreetMap Improve this map' ) ;
1531
+ assertLinks ( s , [
1532
+ 'https://www.mapbox.com/about/maps/' ,
1533
+ 'http://www.openstreetmap.org/about/' ,
1534
+ 'https://www.mapbox.com/map-feedback/' // Improve this map
1535
+ ] ) ;
1510
1536
} )
1511
1537
. then ( done , done . fail ) ;
1512
1538
} ) ;
0 commit comments