Fixed test failures on IE 10

This commit is contained in:
Steve Gravrock
2021-06-05 13:13:46 -07:00
parent 6aecf16cde
commit 1e50b49092

View File

@@ -917,22 +917,30 @@ describe('matchersUtil', function() {
// eslint-disable-next-line compat/compat // eslint-disable-next-line compat/compat
[ [
Int8Array, 'Int8Array',
Uint8Array, 'Uint8Array',
Uint8ClampedArray, 'Uint8ClampedArray',
Int16Array, 'Int16Array',
Uint16Array, 'Uint16Array',
Int32Array, 'Int32Array',
Uint32Array, 'Uint32Array',
Float32Array, 'Float32Array',
Float64Array 'Float64Array'
].forEach(function(TypedArrayCtor) { ].forEach(function(typeName) {
function requireType() {
var TypedArrayCtor = jasmine.getGlobal()[typeName];
if (!TypedArrayCtor) {
pending('Browser does not support ' + typeName);
}
return TypedArrayCtor;
}
it( it(
'passes for ' + 'passes for ' + typeName + 's with same length and content',
TypedArrayCtor.name +
's with same length and content',
function() { function() {
jasmine.getEnv().requireFunctioningTypedArrays(); var TypedArrayCtor = requireType();
var a1 = new TypedArrayCtor(2); var a1 = new TypedArrayCtor(2);
var a2 = new TypedArrayCtor(2); var a2 = new TypedArrayCtor(2);
a1[0] = a2[0] = 0; a1[0] = a2[0] = 0;
@@ -941,23 +949,18 @@ describe('matchersUtil', function() {
} }
); );
it( it('fails for ' + typeName + 's with different length', function() {
'fails for ' + TypedArrayCtor.name + 's with different length', var TypedArrayCtor = requireType();
function() { var a1 = new TypedArrayCtor(2);
jasmine.getEnv().requireFunctioningTypedArrays(); var a2 = new TypedArrayCtor(1);
var a1 = new TypedArrayCtor(2); a1[0] = a1[1] = a2[0] = 0;
var a2 = new TypedArrayCtor(1); expect(jasmineUnderTest.matchersUtil.equals(a1, a2)).toBe(false);
a1[0] = a1[1] = a2[0] = 0; });
expect(jasmineUnderTest.matchersUtil.equals(a1, a2)).toBe(false);
}
);
it( it(
'fails for ' + 'fails for ' + typeName + 's with same length but different content',
TypedArrayCtor.name +
's with same length but different content',
function() { function() {
jasmine.getEnv().requireFunctioningTypedArrays(); var TypedArrayCtor = requireType();
var a1 = new TypedArrayCtor(1); var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1); var a2 = new TypedArrayCtor(1);
a1[0] = 0; a1[0] = 0;
@@ -966,8 +969,8 @@ describe('matchersUtil', function() {
} }
); );
it('checks nonstandard properties', function() { it('checks nonstandard properties of ' + typeName, function() {
jasmine.getEnv().requireFunctioningTypedArrays(); var TypedArrayCtor = requireType();
var a1 = new TypedArrayCtor(1); var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1); var a2 = new TypedArrayCtor(1);
a1[0] = a2[0] = 0; a1[0] = a2[0] = 0;
@@ -975,8 +978,8 @@ describe('matchersUtil', function() {
expect(jasmineUnderTest.matchersUtil.equals(a1, a2)).toBe(false); expect(jasmineUnderTest.matchersUtil.equals(a1, a2)).toBe(false);
}); });
it('works with custom equality testers', function() { it('works with custom equality testers with ' + typeName, function() {
jasmine.getEnv().requireFunctioningTypedArrays(); var TypedArrayCtor = requireType();
var a1 = new TypedArrayCtor(1); var a1 = new TypedArrayCtor(1);
var a2 = new TypedArrayCtor(1); var a2 = new TypedArrayCtor(1);
var matchersUtil = new jasmineUnderTest.MatchersUtil({ var matchersUtil = new jasmineUnderTest.MatchersUtil({