mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Improve equals() test helper.
This commit is contained in:
parent
716cf1acb8
commit
507520f79d
1 changed files with 7 additions and 7 deletions
|
@ -45,15 +45,15 @@ function equals(actual, expected, message, tolerance) {
|
|||
if (tolerance !== undefined) {
|
||||
var ok = Math.abs(actual - expected) <= tolerance;
|
||||
return QUnit.push(ok, ok ? expected : actual, expected, message);
|
||||
} else if (actual && actual.equals) {
|
||||
// Support calling of #equals() on the actual or expected value, and
|
||||
// automatically convert displayed values to strings.
|
||||
return QUnit.push(actual.equals(expected), actual, expected, message);
|
||||
} else if (expected && expected.equals) {
|
||||
// Support calling of #equals() on the expected value, and automatically
|
||||
// convert displayed values to strings.
|
||||
return QUnit.push(expected.equals(actual), actual + '', expected + '',
|
||||
message);
|
||||
} else {
|
||||
// Let's be strict
|
||||
return strictEqual(actual, expected, message);
|
||||
return QUnit.push(expected.equals(actual), actual, expected, message);
|
||||
}
|
||||
// Let's be strict
|
||||
return strictEqual(actual, expected, message);
|
||||
}
|
||||
|
||||
function test(testName, expected) {
|
||||
|
|
Loading…
Reference in a new issue