mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
f71e32d4b4
(cherry-picked from 3dd3d1357d
)
Fixes gh-2283
Closes gh-2292
27 lines
758 B
JavaScript
27 lines
758 B
JavaScript
QUnit.extend( QUnit.assert, {
|
|
|
|
/**
|
|
* Check the sequence/order
|
|
*
|
|
* @example test('Example unit test', function(assert) { assert.step(1); setTimeout(function () { assert.step(3); start(); }, 100); assert.step(2); stop(); });
|
|
* @param Number expected The excepted step within the test()
|
|
* @param String message (optional)
|
|
*/
|
|
step: function (expected, message) {
|
|
// increment internal step counter.
|
|
QUnit.config.current.step++;
|
|
if (typeof message === "undefined") {
|
|
message = "step " + expected;
|
|
}
|
|
var actual = QUnit.config.current.step;
|
|
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Reset the step counter for every test()
|
|
*/
|
|
QUnit.testStart(function () {
|
|
QUnit.config.current.step = 0;
|
|
});
|