From a40d0005613ae397b38722a5de747489ab34d630 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 22 Feb 2019 17:04:10 +0200 Subject: [PATCH] fix tests for https --- test/spec/feature_layer.js | 15 +++++-------- test/spec/format_url.js | 14 ++++++------ test/spec/geocoder.js | 27 ++++++++++++----------- test/spec/geocoder_control.js | 40 +++++++++++++++++------------------ test/spec/grid_layer.js | 4 ++-- test/spec/map.js | 22 +++++++++++-------- test/spec/mapbox_logo.js | 6 +++--- test/spec/share_control.js | 2 +- test/spec/style_layer.js | 4 ++-- test/spec/tile_layer.js | 4 ++-- 10 files changed, 68 insertions(+), 70 deletions(-) diff --git a/test/spec/feature_layer.js b/test/spec/feature_layer.js index 9fcaa0a81..37f6ac14f 100644 --- a/test/spec/feature_layer.js +++ b/test/spec/feature_layer.js @@ -20,7 +20,7 @@ describe('L.mapbox.featureLayer', function() { }); it('loads data from a GeoJSON URL', function() { - var url = 'http://api.tiles.mapbox.com/v4/examples.map-zr0njcqy/features.json', + var url = 'https://api.tiles.mapbox.com/v4/examples.map-zr0njcqy/features.json', layer = L.mapbox.featureLayer(url); server.respondWith("GET", url, @@ -57,11 +57,6 @@ describe('L.mapbox.featureLayer', function() { }); describe("#loadURL", function() { - it('returns self', function() { - var layer = L.mapbox.featureLayer(); - expect(layer.loadURL('http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json')).to.eql(layer); - }); - it('emits a ready event', function(done) { var layer = L.mapbox.featureLayer(); @@ -69,9 +64,9 @@ describe('L.mapbox.featureLayer', function() { done(); }); - layer.loadURL('http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + layer.loadURL('https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geoJson)]); server.respond(); }); @@ -85,9 +80,9 @@ describe('L.mapbox.featureLayer', function() { done(); }); - layer.loadURL('http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + layer.loadURL('https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [400, { "Content-Type": "application/json" }, JSON.stringify({error: 'error'})]); server.respond(); }); diff --git a/test/spec/format_url.js b/test/spec/format_url.js index 8c83cd558..b1c4e805f 100644 --- a/test/spec/format_url.js +++ b/test/spec/format_url.js @@ -10,11 +10,11 @@ describe("format_url", function() { }); it('returns a v4 URL with access_token parameter', function() { - expect(internals.url('/v4/user.map.json')).to.equal('http://a.tiles.mapbox.com/v4/user.map.json?access_token=key') + expect(internals.url('/v4/user.map.json')).to.equal('https://a.tiles.mapbox.com/v4/user.map.json?access_token=key') }); it('uses provided access token', function() { - expect(internals.url('/v4/user.map.json', 'token')).to.equal('http://a.tiles.mapbox.com/v4/user.map.json?access_token=token') + expect(internals.url('/v4/user.map.json', 'token')).to.equal('https://a.tiles.mapbox.com/v4/user.map.json?access_token=token') }); it('throws an error if no access token is provided', function() { @@ -47,13 +47,13 @@ describe("format_url", function() { expect(internals.url.tileJSON('http://a.tiles.mapbox.com/v3/user.map.json')).to.equal('http://a.tiles.mapbox.com/v3/user.map.json') }); - it('returns a v4 URL with access_token parameter', function() { - expect(internals.url.tileJSON('user.map')).to.equal('http://a.tiles.mapbox.com/v4/user.map.json?access_token=key') + it('returns a v4 URL with access_token parameter, uses https and appends &secure', function() { + expect(internals.url.tileJSON('user.map')).to.equal('https://a.tiles.mapbox.com/v4/user.map.json?access_token=key&secure'); }); - it('appends &secure and uses https when FORCE_HTTPS is set', function() { - internals.config.FORCE_HTTPS = true; - expect(internals.url.tileJSON('user.map')).to.equal('https://a.tiles.mapbox.com/v4/user.map.json?access_token=key&secure'); + it('does not append &secure and uses http when FORCE_HTTPS is set to false', function() { + internals.config.FORCE_HTTPS = false; + expect(internals.url.tileJSON('user.map')).to.equal('http://a.tiles.mapbox.com/v4/user.map.json?access_token=key'); }); }); diff --git a/test/spec/geocoder.js b/test/spec/geocoder.js index 3a7618530..fef33ea43 100644 --- a/test/spec/geocoder.js +++ b/test/spec/geocoder.js @@ -13,38 +13,37 @@ describe('L.mapbox.geocoder', function() { it('supports multiple arguments', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL(['austin', 'houston'])) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key'); }); it('supports proximity', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], proximity: [10, 15]})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&proximity=15,10'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&proximity=15,10'); }); it('supports country option', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], country: 'us'})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&country=us'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&country=us'); }); it('supports bbox option', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], bbox: [ -104.0458814, 26.0696823, -93.7347459, 36.4813628 ]})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/ - austin;houston.json?access_token=key&bbox='-104.0458814,26.0696823,-93.7347459,36.4813628'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&bbox=-104.0458814,26.0696823,-93.7347459,36.4813628'); }); it('supports autocomplete option', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], country: 'us', autocomplete: false})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&country=us&autocomplete=false'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&country=us&autocomplete=false'); }); it('rounds proximity params correctly', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], proximity: L.latLng(-10.12345, 15.67890)})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&proximity=15.679,-10.123'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&proximity=15.679,-10.123'); }); it('rounds reverse ') @@ -52,9 +51,9 @@ describe('L.mapbox.geocoder', function() { it('supports types', function() { var g = L.mapbox.geocoder('mapbox.places'); expect(g.queryURL({query: ['austin', 'houston'], types: 'place'})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&types=place'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&types=place'); expect(g.queryURL({query: ['austin', 'houston'], types: ['place', 'address']})) - .to.eql('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&types=place,address'); + .to.eql('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key&types=place,address'); }); }); @@ -63,7 +62,7 @@ describe('L.mapbox.geocoder', function() { var g = L.mapbox.geocoder('mapbox.places'); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin;houston.json?access_token=key', [200, { 'Content-Type': 'application/json' }, JSON.stringify(helpers.geocoderBulk)]); g.query(['austin', 'houston'], function(err, res) { @@ -78,7 +77,7 @@ describe('L.mapbox.geocoder', function() { var g = L.mapbox.geocoder('mapbox.places'); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); g.query('austin', function(err, res) { @@ -94,7 +93,7 @@ describe('L.mapbox.geocoder', function() { var g = L.mapbox.geocoder('mapbox.places'); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/nonesuch.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/nonesuch.json?access_token=key', [200, { 'Content-Type': 'application/json' }, JSON.stringify({"type":"FeatureCollection","query":["nonesuch"],"features":[]})]); g.query('nonesuch', function(err, res) { @@ -111,7 +110,7 @@ describe('L.mapbox.geocoder', function() { var g = L.mapbox.geocoder('mapbox.places'); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/-97.7%2C30.3.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/-97.7%2C30.3.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderReverse)]); g.reverseQuery({ lat: 30.3, lng: -97.7 }, function(err, res) { @@ -126,7 +125,7 @@ describe('L.mapbox.geocoder', function() { var g = L.mapbox.geocoder('mapbox.places'); server.respondWith('GET', - /http:\/\/a\.tiles\.mapbox\.com\/geocoding\/v5\/mapbox.places\/[\-\d\.]+(%2C|,)[\-\d\.]+\.json\?access_token=key/, + /https:\/\/a\.tiles\.mapbox\.com\/geocoding\/v5\/mapbox.places\/[\-\d\.]+(%2C|,)[\-\d\.]+\.json\?access_token=key/, [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderReverseRounded)]); g.reverseQuery({ lat: 30.1234567890, lng: -97.0987654321 }, function(err, res) { diff --git a/test/spec/geocoder_control.js b/test/spec/geocoder_control.js index 6a8c09903..78d669358 100644 --- a/test/spec/geocoder_control.js +++ b/test/spec/geocoder_control.js @@ -17,7 +17,7 @@ describe('L.mapbox.geocoderControl', function() { expect(control instanceof L.mapbox.GeocoderControl).to.eql(true); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/austin.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); control._input.value = 'austin'; @@ -32,7 +32,7 @@ describe('L.mapbox.geocoderControl', function() { control = L.mapbox.geocoderControl('mapbox.places', { proximity: false }).addTo(map); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderWhiteHouse)]); control._input.value = 'white house'; @@ -51,7 +51,7 @@ describe('L.mapbox.geocoderControl', function() { }).addTo(map); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderWhiteHouse)]); control._input.value = 'white house'; @@ -74,7 +74,7 @@ describe('L.mapbox.geocoderControl', function() { }).addTo(map); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key&country=us&autocomplete=false', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key&country=us&autocomplete=false', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderWhiteHouse)]); control._input.value = 'white house'; @@ -95,7 +95,7 @@ describe('L.mapbox.geocoderControl', function() { map.setView([0, 0], 14); server.respondWith('GET', - 'http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', + 'https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/white%20house.json?access_token=key', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderWhiteHouse)]); control._input.value = 'white house'; @@ -108,12 +108,12 @@ describe('L.mapbox.geocoderControl', function() { it('sets url based on an id', function() { var control = L.mapbox.geocoderControl('mapbox.places'); - expect(control.getURL()).to.equal('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=key'); + expect(control.getURL()).to.equal('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=key'); }); it('supports custom access token', function() { var control = L.mapbox.geocoderControl('mapbox.places', {accessToken: 'custom'}); - expect(control.getURL()).to.equal('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=custom'); + expect(control.getURL()).to.equal('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=custom'); }); it('#setURL', function() { @@ -125,7 +125,7 @@ describe('L.mapbox.geocoderControl', function() { it('#setID', function() { var control = L.mapbox.geocoderControl('mapbox.places'); expect(control.setID('mapbox.places')).to.eql(control); - expect(control.getURL()).to.equal('http://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=key'); + expect(control.getURL()).to.equal('https://a.tiles.mapbox.com/geocoding/v5/mapbox.places/{query}.json?access_token=key'); }); it('is by default in the top left', function() { @@ -143,14 +143,14 @@ describe('L.mapbox.geocoderControl', function() { describe('#keepOpen', function(done) { it('true', function() { var map = new L.Map(document.createElement('div')); - var control = L.mapbox.geocoderControl('http://example.com/{query}.json', { + var control = L.mapbox.geocoderControl('https://example.com/{query}.json', { keepOpen: true }).addTo(map); expect(control._container.className).to.eql('leaflet-control-mapbox-geocoder leaflet-bar leaflet-control active'); }); it('false', function() { var map = new L.Map(document.createElement('div')); - var control = L.mapbox.geocoderControl('http://example.com/{query}.json').addTo(map); + var control = L.mapbox.geocoderControl('https://example.com/{query}.json').addTo(map); expect(control._container.className).to.eql('leaflet-control-mapbox-geocoder leaflet-bar leaflet-control'); }); }); @@ -160,7 +160,7 @@ describe('L.mapbox.geocoderControl', function() { beforeEach(function() { map = new L.Map(document.createElement('div')); - control = L.mapbox.geocoderControl('http://example.com/{query}.json', { + control = L.mapbox.geocoderControl('https://example.com/{query}.json', { proximity: false }).addTo(map); }); @@ -175,7 +175,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'austin'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/austin.json', + server.respondWith('GET', 'https://example.com/austin.json', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); server.respond(); }); @@ -188,7 +188,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'unfindable'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/unfindable.json', + server.respondWith('GET', 'https://example.com/unfindable.json', [200, { "Content-Type": "application/json" }, JSON.stringify({features:[]})]); server.respond(); }); @@ -202,7 +202,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'austin'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/austin.json', + server.respondWith('GET', 'https://example.com/austin.json', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); server.respond(); }); @@ -211,7 +211,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'chester'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/chester.json', + server.respondWith('GET', 'https://example.com/chester.json', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderMulti)]); server.respond(); @@ -233,7 +233,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'austin'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/austin.json', + server.respondWith('GET', 'https://example.com/austin.json', [400, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); server.respond(); }); @@ -244,7 +244,7 @@ describe('L.mapbox.geocoderControl', function() { beforeEach(function() { map = new L.Map(document.createElement('div')); - control = L.mapbox.geocoderControl('http://example.com/{query}.json', { + control = L.mapbox.geocoderControl('https://example.com/{query}.json', { autocomplete: true, proximity: false }).addTo(map); @@ -259,7 +259,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'austin'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/austin.json', + server.respondWith('GET', 'https://example.com/austin.json', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); server.respond(); }); @@ -270,7 +270,7 @@ describe('L.mapbox.geocoderControl', function() { beforeEach(function() { map = new L.Map(document.createElement('div'), { center: [0,0], zoom: 0}); - control = L.mapbox.geocoderControl('http://example.com/{query}.json', { + control = L.mapbox.geocoderControl('https://example.com/{query}.json', { autocomplete: true, proximity: true }).addTo(map); @@ -285,7 +285,7 @@ describe('L.mapbox.geocoderControl', function() { control._input.value = 'austin'; happen.once(control._form, { type: 'submit' }); - server.respondWith('GET', 'http://example.com/austin.json&proximity=0,0', + server.respondWith('GET', 'https://example.com/austin.json&proximity=0,0', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.geocoderAustin)]); server.respond(); }); diff --git a/test/spec/grid_layer.js b/test/spec/grid_layer.js index db19b922e..7289fb382 100644 --- a/test/spec/grid_layer.js +++ b/test/spec/grid_layer.js @@ -45,7 +45,7 @@ describe('L.mapbox.gridLayer', function() { }); it('loads TileJSON from a URL', function(done) { - var layer = L.mapbox.gridLayer('http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + var layer = L.mapbox.gridLayer('https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); layer.on('ready', function() { expect(this).to.equal(layer); @@ -53,7 +53,7 @@ describe('L.mapbox.gridLayer', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respond(); }); diff --git a/test/spec/map.js b/test/spec/map.js index 65cd561cb..0cee5724e 100644 --- a/test/spec/map.js +++ b/test/spec/map.js @@ -29,7 +29,7 @@ describe('L.mapbox.map', function() { describe('constructor', function() { it('loads TileJSON from a URL', function(done) { - var map = L.mapbox.map(element, 'http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + var map = L.mapbox.map(element, 'https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); map.on('ready', function() { expect(this).to.equal(map); @@ -37,8 +37,10 @@ describe('L.mapbox.map', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); + server.respondWith("GET", "http://b.tiles.mapbox.com/v3/examples.map-8ced9urs/4/3/6.png", + [200, { "Content-Type": "image/png" }, null); server.respond(); }); @@ -51,13 +53,13 @@ describe('L.mapbox.map', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", + server.respondWith("GET", "https://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respond(); }); it('emits an error event', function(done) { - var map = L.mapbox.map(element, 'http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + var map = L.mapbox.map(element, 'https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); map.on('error', function(e) { expect(this).to.equal(map); @@ -65,13 +67,13 @@ describe('L.mapbox.map', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [400, { "Content-Type": "application/json" }, JSON.stringify({error: 'error'})]); server.respond(); }); it('can deactivate featureLayer', function() { - var map = L.mapbox.map(element, 'http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json', { + var map = L.mapbox.map(element, 'https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json', { featureLayer: false }); expect(map.featureLayer).to.eql(undefined); @@ -81,7 +83,7 @@ describe('L.mapbox.map', function() { var map = L.mapbox.map(element, 'mapbox.map-0l53fhk2') .setView([1, 2], 3); - server.respondWith("GET", "http://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", + server.respondWith("GET", "https://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respond(); @@ -93,7 +95,7 @@ describe('L.mapbox.map', function() { var map = L.mapbox.map(element, 'mapbox.map-0l53fhk2') .setZoom(3); - server.respondWith("GET", "http://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", + server.respondWith("GET", "https://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respond(); @@ -102,9 +104,11 @@ describe('L.mapbox.map', function() { }); it('preserves manually-set marker layer GeoJSON', function() { - var map = L.mapbox.map(element, 'http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + var map = L.mapbox.map(element, 'https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); map.featureLayer.setGeoJSON(helpers.geoJson); + console.log(server.requests); + server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respondWith("GET", "http://a.tiles.mapbox.com/v3/examples.map-8ced9urs/markers.geojson", diff --git a/test/spec/mapbox_logo.js b/test/spec/mapbox_logo.js index a8d0b806e..c8d925fc3 100644 --- a/test/spec/mapbox_logo.js +++ b/test/spec/mapbox_logo.js @@ -43,7 +43,7 @@ describe('mapbox_logo', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", + server.respondWith("GET", "https://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key&secure", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON_mapboxlogo)]); server.respond(); }); @@ -56,8 +56,8 @@ describe('mapbox_logo', function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key", + server.respondWith("GET", "https://a.tiles.mapbox.com/v4/mapbox.map-0l53fhk2.json?access_token=key&secure", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON_mapboxlogoFalse)]); server.respond(); }); -}); \ No newline at end of file +}); diff --git a/test/spec/share_control.js b/test/spec/share_control.js index cc77f716f..898efb27b 100644 --- a/test/spec/share_control.js +++ b/test/spec/share_control.js @@ -55,7 +55,7 @@ describe('L.mapbox.shareControl', function() { expect(element .getElementsByClassName('mapbox-embed')[0].value) - .to.eql(''); + .to.eql(''); }); it('can accept a custom url', function() { diff --git a/test/spec/style_layer.js b/test/spec/style_layer.js index fa0a4270f..7fe3c4cf7 100644 --- a/test/spec/style_layer.js +++ b/test/spec/style_layer.js @@ -22,7 +22,7 @@ describe('L.mapbox.styleLayer', function() { [200, { "Content-Type": "application/json" }, JSON.stringify({"sources":{"composite":{"url":"mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6","type":"vector"}}})]); server.respond(); - server.respondWith('GET', 'http://a.tiles.mapbox.com/v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6.json?access_token=key', + server.respondWith('GET', 'https://a.tiles.mapbox.com/v4/mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v6.json?access_token=key&secure', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON_street_terrain)]); server.respond(); }); @@ -38,7 +38,7 @@ describe('L.mapbox.styleLayer', function() { [200, { "Content-Type": "application/json" }, JSON.stringify({"sources":{"mapbox":{"url":"mapbox://mapbox.mapbox-streets-v6","type":"vector"},"satellite":{"url":"mapbox://mapbox.satellite","type":"raster","tileSize":256}}})]); server.respond(); - server.respondWith('GET', 'http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6,mapbox.satellite.json?access_token=key', + server.respondWith('GET', 'https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6,mapbox.satellite.json?access_token=key&secure', [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON_satellite_streets)]); server.respond(); }); diff --git a/test/spec/tile_layer.js b/test/spec/tile_layer.js index 95f7f8e8d..7bbdd8252 100644 --- a/test/spec/tile_layer.js +++ b/test/spec/tile_layer.js @@ -38,7 +38,7 @@ describe("L.mapbox.tileLayer", function() { }); it('loads TileJSON from a URL', function(done) { - var layer = L.mapbox.tileLayer('http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); + var layer = L.mapbox.tileLayer('https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json'); layer.on('ready', function() { expect(this).to.equal(layer); @@ -46,7 +46,7 @@ describe("L.mapbox.tileLayer", function() { done(); }); - server.respondWith("GET", "http://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", + server.respondWith("GET", "https://a.tiles.mapbox.com/v3/mapbox.map-0l53fhk2.json", [200, { "Content-Type": "application/json" }, JSON.stringify(helpers.tileJSON)]); server.respond(); });