Skip to content

Commit

Permalink
Correcting the Map/Set subclass tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 8, 2015
1 parent 4dcd183 commit 37f5932
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ describe('Collections', function () {

it('should be subclassable', function () {
if (!Object.setPrototypeOf) { return; } // skip test if on IE < 11
var MyMap = function () { Map.call(this, [['a', 'b']]); };
Object.setPrototypeOf(MyMap, Map);
var MyMap = function MyMap() {
var map = new Map([['a', 'b']]);
Object.setPrototypeOf(map, MyMap.prototype);
return map;
};
MyMap.prototype = Object.create(Map.prototype, {
constructor: { value: MyMap }
});
Expand Down Expand Up @@ -527,9 +530,12 @@ describe('Collections', function () {
});

it('should be subclassable', function () {
var MySet = function () { Set.call(this, ['a', 'b']); };
if (!Object.setPrototypeOf) { return; } // skip test if on IE < 11
Object.setPrototypeOf(MySet, Set);
var MySet = function MySet() {
var set = new Set(['a', 'b']);
Object.setPrototypeOf(set, MySet.prototype);
return set;
};
MySet.prototype = Object.create(Set.prototype, {
constructor: { value: MySet }
});
Expand Down

0 comments on commit 37f5932

Please sign in to comment.