Merge pull request #10057 from tschaub/fewer-extensions

Remove unused test extensions
This commit is contained in:
Tim Schaub
2019-09-28 19:02:02 -05:00
committed by GitHub
2 changed files with 0 additions and 60 deletions

View File

@@ -2,21 +2,6 @@
describe('expect.js', function() {
describe('arreqlNaN', function() {
it('considers NaN in array to be equal', function() {
expect([1, NaN, 2]).to.arreqlNaN([1, NaN, 2]);
expect([1, NaN, 2]).not.to.arreqlNaN([1, 1.5, 2]);
});
it('allows a mix of number and string', function() {
expect([1, NaN, 'foo']).to.arreqlNaN([1, NaN, 'foo']);
expect([1, NaN, 'foo']).not.to.arreqlNaN([1, NaN, 'bar']);
expect([1, NaN]).not.to.arreqlNaN([1, 'foo']);
});
});
describe('roughlyEqual', function() {
it('can tell the difference between 1 and 3', function() {

View File

@@ -1,4 +1,3 @@
import {equals} from '../src/ol/array.js';
// avoid importing anything that results in an instanceof check
// since these extensions are global, instanceof checks fail with modules
@@ -292,50 +291,6 @@ import {equals} from '../src/ol/array.js';
};
/**
* Checks if the array sort of equals another array.
* @param {Object} obj The other object.
* @return {expect.Assertion} The assertion.
*/
expect.Assertion.prototype.arreql = function(obj) {
this.assert(
equals(this.obj, obj),
function() {
return 'expected ' + expect.stringify(this.obj) +
' to sort of equal ' + expect.stringify(obj);
},
function() {
return 'expected ' + expect.stringify(this.obj) +
' to sort of not equal ' + expect.stringify(obj);
});
return this;
};
/**
* Checks if the array sort of equals another array (allows NaNs to be equal).
* @param {Object} obj The other object.
* @return {expect.Assertion} The assertion.
*/
expect.Assertion.prototype.arreqlNaN = function(obj) {
function compare(a, i) {
const b = obj[i];
return a === b || (typeof a === 'number' && typeof b === 'number' &&
isNaN(a) && isNaN(b));
}
this.assert(
this.obj.length === obj.length && this.obj.every(compare),
function() {
return 'expected ' + expect.stringify(this.obj) +
' to sort of equal ' + expect.stringify(obj);
},
function() {
return 'expected ' + expect.stringify(this.obj) +
' to sort of not equal ' + expect.stringify(obj);
});
return this;
};
global.createMapDiv = function(width, height) {
const target = document.createElement('div');
const style = target.style;