Fixed toHaveSize matcher on IE 10 & 11
This commit is contained in:
@@ -51,4 +51,15 @@ describe('base helpers', function() {
|
||||
expect(jasmineUnderTest.isAsymmetricEqualityTester_(obj)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSet', function() {
|
||||
it('returns true when the object is a Set', function() {
|
||||
jasmine.getEnv().requireFunctioningSets();
|
||||
expect(jasmineUnderTest.isSet(new Set())).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when the object is not a Set', function() {
|
||||
expect(jasmineUnderTest.isSet({})).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -110,6 +110,7 @@ describe('toHaveSize', function() {
|
||||
});
|
||||
|
||||
it('throws an error for WeakSet', function() {
|
||||
jasmine.getEnv().requireWeakSets();
|
||||
var matcher = jasmineUnderTest.matchers.toHaveSize();
|
||||
|
||||
expect(function() {
|
||||
@@ -118,11 +119,12 @@ describe('toHaveSize', function() {
|
||||
});
|
||||
|
||||
it('throws an error for WeakMap', function() {
|
||||
jasmine.getEnv().requireWeakMaps();
|
||||
var matcher = jasmineUnderTest.matchers.toHaveSize();
|
||||
|
||||
expect(function() {
|
||||
matcher.compare(new WeakMap(), 2);
|
||||
}).toThrowError('Cannot get size of [object WeakMap].');
|
||||
}).toThrowError(/Cannot get size of \[object (WeakMap|Object)\]\./);
|
||||
});
|
||||
|
||||
it('throws an error for DataView', function() {
|
||||
@@ -130,6 +132,6 @@ describe('toHaveSize', function() {
|
||||
|
||||
expect(function() {
|
||||
matcher.compare(new DataView(new ArrayBuffer(128)), 2);
|
||||
}).toThrowError('Cannot get size of [object DataView].');
|
||||
}).toThrowError(/Cannot get size of \[object (DataView|Object)\]\./);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user