First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,18 @@
QUnit.step() - A QUnit Addon For Testing execution in order
============================================================
This addon for QUnit adds a step method that allows you to assert
the proper sequence in which the code should execute.
Example:
test("example test", function () {
function x() {
QUnit.step(2, "function y should be called first");
}
function y() {
QUnit.step(1);
}
y();
x();
});

View file

@ -0,0 +1,25 @@
QUnit.extend( QUnit, {
/**
* Check the sequence/order
*
* @example step(1); setTimeout(function () { step(3); }, 100); step(2);
* @param Number expected The excepted step within the test()
* @param String message (optional)
*/
step: function (expected, message) {
this.config.current.step++; // increment internal step counter.
if (typeof message === "undefined") {
message = "step " + expected;
}
var actual = this.config.current.step;
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
}
});
/**
* Reset the step counter for every test()
*/
QUnit.testStart(function () {
this.config.current.step = 0;
});

View file

@ -0,0 +1,13 @@
module('Step Addon');
test("step", 3, function () {
QUnit.step(1, "step starts at 1");
setTimeout(function () {
start();
QUnit.step(3);
}, 100);
QUnit.step(2, "before the setTimeout callback is run");
stop();
});
test("step counter", 1, function () {
QUnit.step(1, "each test has its own step counter");
});

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite - Step Addon</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script type="text/javascript" src="qunit-step.js"></script>
<script type="text/javascript" src="step-test.js"></script>
</head>
<body>
<div id="qunit"></div>
</body>
</html>