Skip to content

Commit

Permalink
Tests: Allow async domEqual() tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Nov 12, 2012
1 parent d657538 commit 902df84
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/unit/testsuite.js
Expand Up @@ -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.