Add ES6 map support to Jasmine

This commit is contained in:
rmehlinger
2017-04-29 17:58:14 -07:00
parent 2835ca3cce
commit 5ee03f02ed
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());