Merge branch 'map-support' of https://github.com/rmehlinger/jasmine into rmehlinger-map-support

- Merges #1340 from @rmehlinger
- Fixes #1257
This commit is contained in:
Gregg Van Hove
2017-05-19 14:05:18 -07:00
9 changed files with 159 additions and 4 deletions

View File

@@ -0,0 +1,22 @@
(function(env) {
function hasFunctioningMaps() {
if (typeof Map === 'undefined') { return false; }
try {
var s = new Map([['a', 4]]);
if (s.size !== 1) { return false; }
if (s.keys().next().value !== 'a') { return false; }
if (s.values().next().value !== 4) { return false; }
return true;
} catch(e) {
return false;
}
}
env.requireFunctioningMaps = function() {
if (!hasFunctioningMaps()) {
env.pending("Browser has incomplete or missing support for Maps");
}
};
})(jasmine.getEnv());