diff --git a/package.json b/package.json index 255dec09f..f23749f0f 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "imagery": "node data/update_imagery", "lint": "eslint *.js test/spec modules", "start": "node --max-old-space-size=4096 server.js", - "phantom": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/phantom.html spec", "test": "npm-run-all -s lint build test:**", - "test:phantom": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", + "test:phantom": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/phantom.html spec", + "test:iD": "phantomjs --web-security=no node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html spec", "translations": "node data/update_locales" }, "dependencies": { diff --git a/test/spec/phantom.js b/test/spec/phantom.js index 6d0616e0d..2fe8360a6 100644 --- a/test/spec/phantom.js +++ b/test/spec/phantom.js @@ -4,4 +4,7 @@ describe('test some capabilities of PhantomJS', function () { var result = Array.from(s); expect(result).to.eql([1]); }); + it('has ArrayBuffer.isView', function () { + expect(typeof ArrayBuffer.isView).to.eql('function'); + }); }); diff --git a/test/spec/spec_helpers.js b/test/spec/spec_helpers.js index f4c897f44..b5beec3c5 100644 --- a/test/spec/spec_helpers.js +++ b/test/spec/spec_helpers.js @@ -52,6 +52,11 @@ Array.from = function(what) { } }; +// Workaround for `ArrayBuffer.isView` in PhantomJS +// https://github.com/openstreetmap/iD/issues/7072 +if (typeof ArrayBuffer.isView === 'undefined') { + ArrayBuffer.isView = function() { return false; }; +} // Add support for sinon-stubbing `fetch` API // (sinon fakeServer works only on `XMLHttpRequest`)