mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
remove now unneeded refrences to and workarounds for phantomJS
This commit is contained in:
@@ -61,8 +61,7 @@ export function coreFileFetcher() {
|
||||
if (!prom) {
|
||||
_inflight[url] = prom = fetch(url)
|
||||
.then(response => {
|
||||
// fetch in PhantomJS tests may return ok=false and status=0 even if it's okay
|
||||
if ((!response.ok && response.status !== 0) || !response.json) {
|
||||
if (!response.ok || !response.json) {
|
||||
throw new Error(response.status + ' ' + response.statusText);
|
||||
}
|
||||
if (response.status === 204 || response.status === 205) return; // No Content, Reset Content
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('iD.coreFileFetcher', function() {
|
||||
data.cache().test = { hello: 'world' };
|
||||
|
||||
var prom = data.get('test');
|
||||
// expect(prom).to.be.a('promise'); // these are polyfilled in phantomjs
|
||||
expect(prom).to.be.a('promise');
|
||||
prom
|
||||
.then(function(data) {
|
||||
expect(data).to.be.a('object');
|
||||
@@ -28,8 +28,6 @@ describe('iD.coreFileFetcher', function() {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
|
||||
it('returns a promise rejected if we can not get the data', function(done) {
|
||||
@@ -43,15 +41,13 @@ describe('iD.coreFileFetcher', function() {
|
||||
expect(/^Unknown data file/.test(err)).to.be.true;
|
||||
done();
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
|
||||
it('returns a promise to fetch data if we do not already have the data', function(done) {
|
||||
var files = { 'intro_graph': 'data/intro_graph.min.json' };
|
||||
var data = iD.coreFileFetcher().assetPath('../dist/').fileMap(files);
|
||||
var prom = data.get('intro_graph');
|
||||
// expect(prom).to.be.a('promise'); // these are polyfilled in phantomjs
|
||||
expect(prom).to.be.a('promise');
|
||||
prom
|
||||
.then(function(data) {
|
||||
expect(data).to.be.a('object');
|
||||
@@ -61,8 +57,6 @@ describe('iD.coreFileFetcher', function() {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -49,8 +49,6 @@ describe('iD.coreLocations', function() {
|
||||
expect(/^nothing to do/.test(err)).to.be.true;
|
||||
done();
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
|
||||
it('resolves locationSets, assigning locationSetID', function(done) {
|
||||
@@ -69,8 +67,6 @@ describe('iD.coreLocations', function() {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
|
||||
it('resolves locationSets, falls back to world locationSetID on errror', function(done) {
|
||||
@@ -89,8 +85,6 @@ describe('iD.coreLocations', function() {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
});
|
||||
|
||||
@@ -150,8 +144,6 @@ describe('iD.coreLocations', function() {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ describe('iD.coreValidator', function () {
|
||||
.catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
window.setTimeout(function() {}, 20); // async - to let the promise settle in phantomjs
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
describe('test some capabilities of PhantomJS', function () {
|
||||
it('Array.from(Set)', function () {
|
||||
var s = new Set([1,1]);
|
||||
var result = Array.from(s);
|
||||
expect(result).to.eql([1]);
|
||||
});
|
||||
it('has ArrayBuffer.isView', function () {
|
||||
expect(typeof ArrayBuffer.isView).to.eql('function');
|
||||
});
|
||||
});
|
||||
@@ -75,8 +75,6 @@ describe('iD.svgData', function () {
|
||||
'</Document>' +
|
||||
'</kml>';
|
||||
|
||||
|
||||
// this is because PhantomJS hasn't implemented a proper File constructor
|
||||
function makeFile(contents, fileName, mimeType) {
|
||||
var blob = new Blob([contents], { type: mimeType });
|
||||
blob.lastModifiedDate = new Date();
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
describe('iD.uiCmd', function () {
|
||||
var orig;
|
||||
var ua = navigator.userAgent;
|
||||
var isPhantom = (navigator.userAgent.match(/PhantomJS/) !== null);
|
||||
var uaMock = function () { return ua; };
|
||||
|
||||
beforeEach(function() {
|
||||
/* 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);
|
||||
}
|
||||
orig = navigator.__lookupGetter__('userAgent');
|
||||
navigator.__defineGetter__('userAgent', uaMock);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
/* restore userAgent */
|
||||
if (isPhantom) {
|
||||
navigator = orig;
|
||||
} else {
|
||||
navigator.__defineGetter__('userAgent', orig);
|
||||
}
|
||||
navigator.__defineGetter__('userAgent', orig);
|
||||
/* eslint-enable no-global-assign */
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user