diff options
Diffstat (limited to 'tests/unit/testsuite.js')
-rw-r--r-- | tests/unit/testsuite.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index bf17670f7..f3c0982fb 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -170,6 +170,14 @@ TestHelpers.commonWidgetTests = function( widget, settings ) { }; /* + * Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough + */ +window.closeEnough = function( actual, expected, maxDifference, message ) { + var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference; + QUnit.push(passes, actual, expected, message); +}; + +/* * Experimental assertion for comparing DOM objects. * * Serializes an element and some properties and attributes and it's children if any, otherwise the text. |