diff --git a/spec/Layers/TiledMapLayerSpec.js b/spec/Layers/TiledMapLayerSpec.js index 97b8ffd68..502cc5b45 100644 --- a/spec/Layers/TiledMapLayerSpec.js +++ b/spec/Layers/TiledMapLayerSpec.js @@ -15,6 +15,8 @@ describe('L.esri.TiledMapLayer', function () { } var url = 'http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer'; + var subdomainsUrl = 'http://{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer'; + var subdomainsArray = ['server', 'services']; var layer; var server; var map; @@ -130,19 +132,38 @@ describe('L.esri.TiledMapLayer', function () { }); it('should display a metadata attribution if one is present and no attribution option was passed', function () { - var copyrightText; + server.respondWith('GET', 'http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/?f=json', JSON.stringify({ + copyrightText: 'foo', + spatialReference: { + wkid: 102100, + latestWkid: 3857 + } + })); + layer = L.esri.tiledMapLayer({ url: url }).addTo(map); - layer.on('load', function () { - layer.metadata(function (err, meta) { - if (meta && meta.hasOwnProperty(copyrightText)) { - copyrightText = meta.copyrightText; - expect(map.attributionControl._container.innerHTML).to.contain(copyrightText); - } - }); - }); + server.respond(); + expect(map.attributionControl._container.innerHTML).to.contain('foo'); + }); + + it('should display a metadata attribution if one is present and no attribution option was passed and url is defined with subdomains', function () { + server.respondWith('GET', 'http://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/?f=json', JSON.stringify({ + copyrightText: 'foo', + spatialReference: { + wkid: 102100, + latestWkid: 3857 + } + })); + + layer = L.esri.tiledMapLayer({ + url: subdomainsUrl, + subdomains: subdomainsArray + }).addTo(map); + + server.respond(); + expect(map.attributionControl._container.innerHTML).to.contain('foo'); }); }); /* eslint-enable handle-callback-err */