@@ -1471,12 +1471,26 @@ describe('mapbox plots', function() {
14711471 } , LONG_TIMEOUT_INTERVAL ) ;
14721472
14731473 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+
14741484 it ( '@gl should be displayed for style "Carto"' , function ( done ) {
14751485 Plotly . newPlot ( gd , [ { type : 'scattermapbox' } ] , { mapbox : { style : 'carto-darkmatter' } } )
14761486 . then ( function ( ) {
14771487 var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
14781488 expect ( s . size ( ) ) . toBe ( 1 ) ;
14791489 expect ( s . text ( ) ) . toEqual ( '© Carto © OpenStreetMap' ) ;
1490+ assertLinks ( s , [
1491+ 'https://carto.com/' ,
1492+ 'https://www.openstreetmap.org/copyright'
1493+ ] ) ;
14801494 } )
14811495 . then ( done , done . fail ) ;
14821496 } ) ;
@@ -1487,6 +1501,10 @@ describe('mapbox plots', function() {
14871501 var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
14881502 expect ( s . size ( ) ) . toBe ( 1 ) ;
14891503 expect ( s . text ( ) ) . toEqual ( '© Stamen Design LLC © OpenStreetMap' ) ;
1504+ assertLinks ( s , [
1505+ 'https://stamen.com/' ,
1506+ 'https://www.openstreetmap.org/copyright'
1507+ ] ) ;
14901508 } )
14911509 . then ( done , done . fail ) ;
14921510 } ) ;
@@ -1497,6 +1515,9 @@ describe('mapbox plots', function() {
14971515 var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
14981516 expect ( s . size ( ) ) . toBe ( 1 ) ;
14991517 expect ( s . text ( ) ) . toEqual ( '© OpenStreetMap' ) ;
1518+ assertLinks ( s , [
1519+ 'https://www.openstreetmap.org/copyright'
1520+ ] ) ;
15001521 } )
15011522 . then ( done , done . fail ) ;
15021523 } ) ;
@@ -1507,6 +1528,11 @@ describe('mapbox plots', function() {
15071528 var s = d3SelectAll ( '.mapboxgl-ctrl-attrib' ) ;
15081529 expect ( s . size ( ) ) . toBe ( 1 ) ;
15091530 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+ ] ) ;
15101536 } )
15111537 . then ( done , done . fail ) ;
15121538 } ) ;
0 commit comments