Checking for Set isn't browser dependant
This commit is contained in:
@@ -20,23 +20,4 @@
|
|||||||
return /Firefox\/([0-9]{0,})/.exec(userAgent);
|
return /Firefox\/([0-9]{0,})/.exec(userAgent);
|
||||||
});
|
});
|
||||||
|
|
||||||
function hasFunctioningSets() {
|
|
||||||
if (typeof Set !== 'undefined') { return false; }
|
|
||||||
|
|
||||||
try {
|
|
||||||
var s = new Set([4]);
|
|
||||||
if (s.size !== 1) { return false; }
|
|
||||||
if (s.values().next().value !== 4) { return false; }
|
|
||||||
return true;
|
|
||||||
} catch(e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env.requireFunctioningSets = function() {
|
|
||||||
if (!hasFunctioningSets()) {
|
|
||||||
pending("Browser has incomplete or missing support for Sets");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})(jasmine.getEnv());
|
})(jasmine.getEnv());
|
||||||
|
|||||||
21
spec/helpers/checkForSet.js
Normal file
21
spec/helpers/checkForSet.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
(function(env) {
|
||||||
|
function hasFunctioningSets() {
|
||||||
|
if (typeof Set === 'undefined') { return false; }
|
||||||
|
|
||||||
|
try {
|
||||||
|
var s = new Set([4]);
|
||||||
|
if (s.size !== 1) { return false; }
|
||||||
|
if (s.values().next().value !== 4) { return false; }
|
||||||
|
return true;
|
||||||
|
} catch(e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env.requireFunctioningSets = function() {
|
||||||
|
if (!hasFunctioningSets()) {
|
||||||
|
pending("Browser has incomplete or missing support for Sets");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jasmine.getEnv());
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"npmPackage/**/*.js"
|
"npmPackage/**/*.js"
|
||||||
],
|
],
|
||||||
"helpers": [
|
"helpers": [
|
||||||
|
"helpers/checkForSet.js",
|
||||||
"helpers/nodeDefineJasmineUnderTest.js"
|
"helpers/nodeDefineJasmineUnderTest.js"
|
||||||
],
|
],
|
||||||
"random": true
|
"random": true
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ src_files:
|
|||||||
stylesheets:
|
stylesheets:
|
||||||
helpers:
|
helpers:
|
||||||
- 'helpers/BrowserFlags.js'
|
- 'helpers/BrowserFlags.js'
|
||||||
|
- 'helpers/checkForSet.js'
|
||||||
- 'helpers/defineJasmineUnderTest.js'
|
- 'helpers/defineJasmineUnderTest.js'
|
||||||
spec_files:
|
spec_files:
|
||||||
- '**/*[Ss]pec.js'
|
- '**/*[Ss]pec.js'
|
||||||
|
|||||||
Reference in New Issue
Block a user