aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/testsuite.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-11-12 11:19:20 -0500
committerScott González <scott.gonzalez@gmail.com>2012-11-12 11:19:20 -0500
commit902df84fce790178da78c5830498911a487d50cf (patch)
tree2d42b49bdcb1cb5097f6c3b1177be880ca1930da /tests/unit/testsuite.js
parentd657538ed57a96b610853d69e9fbf559c5ae230f (diff)
downloadjquery-ui-902df84fce790178da78c5830498911a487d50cf.tar.gz
jquery-ui-902df84fce790178da78c5830498911a487d50cf.zip
Tests: Allow async domEqual() tests.
Diffstat (limited to 'tests/unit/testsuite.js')
-rw-r--r--tests/unit/testsuite.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js
index f3c0982fb..42fdf4f9e 100644
--- a/tests/unit/testsuite.js
+++ b/tests/unit/testsuite.js
@@ -271,11 +271,22 @@ window.domEqual = function( selector, modifier, message ) {
}
return result;
}
+
+ function done() {
+ actual = extract( $( selector ) );
+ QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+ }
+
+ // Get current state prior to modifier
expected = extract( $( selector ) );
- modifier( $( selector ) );
- actual = extract( $( selector ) );
- QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+ // Run modifier (async or sync), then compare state via done()
+ if ( modifier.length ) {
+ modifier( done );
+ } else {
+ modifier();
+ done();
+ }
};
}( jQuery ));