Tests: Allow async domEqual() tests.

This commit is contained in:
Scott González 2012-11-12 11:19:20 -05:00
parent d657538ed5
commit 902df84fce

View File

@ -271,11 +271,22 @@ window.domEqual = function( selector, modifier, message ) {
} }
return result; return result;
} }
expected = extract( $( selector ) );
modifier( $( selector ) );
function done() {
actual = extract( $( selector ) ); actual = extract( $( selector ) );
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
}
// Get current state prior to modifier
expected = extract( $( selector ) );
// Run modifier (async or sync), then compare state via done()
if ( modifier.length ) {
modifier( done );
} else {
modifier();
done();
}
}; };
}( jQuery )); }( jQuery ));