Skip to content
Permalink
Browse files

Tests: Allow async domEqual() tests.

  • Loading branch information...
scottgonzalez committed Nov 12, 2012
1 parent d657538 commit 902df84fce790178da78c5830498911a487d50cf
Showing with 14 additions and 3 deletions.
  1. +14 −3 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 ));

0 comments on commit 902df84

Please sign in to comment.
You can’t perform that action at this time.