removed: user mocks from image service test specs

This commit is contained in:
Thomas Hervey
2018-06-22 14:00:52 -04:00
parent 2786974210
commit db1c896ef2
4 changed files with 53 additions and 44 deletions

2
.gitignore vendored
View File

@@ -18,3 +18,5 @@ land.html
/css/img
/test/css
/test/img
/.vscode/

49
dist/locales/en.json vendored
View File

@@ -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": {

View File

@@ -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 */
});

View File

@@ -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 */
});