summaryrefslogtreecommitdiffstats
path: root/external/qunit-assert-step/qunit-assert-step.js
blob: 90bca18cf6ef11f9d5d5a635f322e082204a885b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
});