- Linting (ESLint): Stricter rules (or switch to warning)

- Breaking internal API change: `updateGripCursor` moved to be class method of Selector rather than instance method
- Breaking internal API change: `subpathIsClosed` moved to be class method of `Path` rather than instance method
- Refactoring: Reuse utilities base64 encoder for SVG icons plugin
- Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and `mouseDown` (may also be a boolean) of `pathActions`; other JSDoc additions/improvements
This commit is contained in:
Brett Zamir
2018-11-07 14:51:50 +08:00
parent 901c9547fe
commit 7c470e9909
126 changed files with 2081 additions and 1373 deletions

View File

@@ -1,5 +1,12 @@
const NEAR_ZERO = 5e-6; // 0.000005, Firefox fails at higher levels of precision.
/**
* Checks that the supplied values are equal with a high though not absolute degree of precision.
* @param {Float} actual
* @param {Float} expected
* @param {string} message
* @returns {undefined}
*/
function almostEquals (actual, expected, message) {
message = message || (actual + ' did not equal ' + expected);
this.pushResult({
@@ -10,6 +17,10 @@ function almostEquals (actual, expected, message) {
});
}
/**
* @param {external:qunit} QUnit
* @returns {external:qunit} The same instance passed in after extending
*/
export default function extend (QUnit) {
QUnit.extend(QUnit.assert, {
almostEquals

View File

@@ -10,7 +10,7 @@
* @param {string} [message] Defaults to structured message
* @returns {undefined}
*/
function close (actual, expected, maxDifference, message) {
function close (actual, expected, maxDifference, message) { // eslint-disable-line no-shadow
const actualDiff = (actual === expected) ? 0 : Math.abs(actual - expected),
result = actualDiff <= maxDifference;
message = message || (actual + ' should be within ' + maxDifference + ' (inclusive) of ' + expected + (result ? '' : '. Actual: ' + actualDiff));
@@ -96,6 +96,10 @@ function notClosePercent (actual, expected, minPercentDifference, message) {
this.pushResult({result, actual, expected, message});
}
/**
* @param {external:qunit} QUnit
* @returns {external:qunit} The same instance passed in after extending
*/
export default function extend (QUnit) {
QUnit.extend(QUnit.assert, {
close,

View File

@@ -1,3 +1,10 @@
/**
* Expects an out of bounds `INDEX_SIZE_ERR` exception.
* @param {GenericObject} obj
* @param {GenericCallback} fn
* @param {Any} arg1
* @returns {undefined}
*/
function expectOutOfBoundsException (obj, fn, arg1) {
const expected = true;
const message = 'Caught an INDEX_SIZE_ERR exception';
@@ -10,9 +17,13 @@ function expectOutOfBoundsException (obj, fn, arg1) {
}
}
const actual = result;
console.log('aaa', result, actual, expected);
this.pushResult({result, actual, expected, message});
}
/**
* @param {external:qunit} QUnit
* @returns {external:qunit} The same instance passed in after extending
*/
export default function extend (QUnit) {
QUnit.extend(QUnit.assert, {
expectOutOfBoundsException