From db1c896ef2b3477209a8b9f9c25773eb8bf58245 Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Fri, 22 Jun 2018 14:00:52 -0400 Subject: [PATCH] removed: user mocks from image service test specs --- .gitignore | 2 ++ dist/locales/en.json | 49 +++++++++++++++++++++++++++++ test/spec/services/mapillary.js | 23 +------------- test/spec/services/openstreetcam.js | 23 +------------- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 5f7ebb0f3..ce1208007 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ land.html /css/img /test/css /test/img + +/.vscode/ diff --git a/dist/locales/en.json b/dist/locales/en.json index 4924c99d0..b704df8fc 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -6877,6 +6877,13 @@ }, "name": "OpenStreetMap (German Style)" }, + "osmse-ekonomiska": { + "attribution": { + "text": "© Lantmäteriet" + }, + "description": "Scan of ´Economic maps´ ca 1950-1980", + "name": "Lantmäteriet Economic Map (historic)" + }, "qa_no_address": { "attribution": { "text": "Simon Poole, Data ©OpenStreetMap contributors" @@ -6906,6 +6913,48 @@ "text": "Maps © Thunderforest, Data © OpenStreetMap contributors" }, "name": "Thunderforest Landscape" + }, + "trafikverket-baninfo": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish railway network, including sidings", + "name": "Trafikverket Railway Network" + }, + "trafikverket-baninfo-option": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish railway network with several options for map layers", + "name": "Trafikverket Railway Network options" + }, + "trafikverket-vagnat": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish NVDB road network", + "name": "Trafikverket Road Network" + }, + "trafikverket-vagnat-extra": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish NVDB extra details: Highway reference, traffic calming, rest area, bus stop, bridge, tunnel, speed camera", + "name": "Trafikverket Road Network extra" + }, + "trafikverket-vagnat-navn": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish NVDB street names", + "name": "Trafikverket Street Names" + }, + "trafikverket-vagnat-option": { + "attribution": { + "text": "© Trafikverket, CC0" + }, + "description": "Swedish NVDB road network with several options for map layers", + "name": "Trafikverket Road Network options" } }, "community": { diff --git a/test/spec/services/mapillary.js b/test/spec/services/mapillary.js index efc7fb510..72046b1b6 100644 --- a/test/spec/services/mapillary.js +++ b/test/spec/services/mapillary.js @@ -1,9 +1,6 @@ describe('iD.serviceMapillary', function() { var dimensions = [64, 64], - ua = navigator.userAgent, - isPhantom = (navigator.userAgent.match(/PhantomJS/) !== null), - uaMock = function () { return ua; }, - context, server, mapillary, orig; + context, server, mapillary; before(function() { @@ -24,28 +21,10 @@ describe('iD.serviceMapillary', function() { server = sinon.fakeServer.create(); mapillary = iD.services.mapillary; mapillary.reset(); - - /* eslint-disable no-global-assign */ - /* mock userAgent */ - if (isPhantom) { - orig = navigator; - navigator = Object.create(orig, { userAgent: { get: uaMock }}); - } else { - orig = navigator.__lookupGetter__('userAgent'); - navigator.__defineGetter__('userAgent', uaMock); - } }); afterEach(function() { server.restore(); - - /* restore userAgent */ - if (isPhantom) { - navigator = orig; - } else { - navigator.__defineGetter__('userAgent', orig); - } - /* eslint-enable no-global-assign */ }); diff --git a/test/spec/services/openstreetcam.js b/test/spec/services/openstreetcam.js index e9d8dbc27..01658facf 100644 --- a/test/spec/services/openstreetcam.js +++ b/test/spec/services/openstreetcam.js @@ -1,9 +1,6 @@ describe('iD.serviceOpenstreetcam', function() { var dimensions = [64, 64], - ua = navigator.userAgent, - isPhantom = (navigator.userAgent.match(/PhantomJS/) !== null), - uaMock = function () { return ua; }, - context, server, openstreetcam, orig; + context, server, openstreetcam; before(function() { iD.services.openstreetcam = iD.serviceOpenstreetcam; @@ -23,28 +20,10 @@ describe('iD.serviceOpenstreetcam', function() { server = sinon.fakeServer.create(); openstreetcam = iD.services.openstreetcam; openstreetcam.reset(); - - /* eslint-disable no-global-assign */ - /* mock userAgent */ - if (isPhantom) { - orig = navigator; - navigator = Object.create(orig, { userAgent: { get: uaMock }}); - } else { - orig = navigator.__lookupGetter__('userAgent'); - navigator.__defineGetter__('userAgent', uaMock); - } }); afterEach(function() { server.restore(); - - /* restore userAgent */ - if (isPhantom) { - navigator = orig; - } else { - navigator.__defineGetter__('userAgent', orig); - } - /* eslint-enable no-global-assign */ });