You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: Modernize and improve documentation examples
* Docs: Modernize and improve documentation examples
* Use modern syntax by default.
Keep a few alternative "classic ES5 syntax" examples,
explicitly described as such.
* Consistent parameter naming test formatting.
* Make the examples for `assert.timeout`, `assert.async`, `assert.verifySteps`,
and `assert.pushResult` more appealing by replacing them with something
that seems more reflecting of current best practices.
* Point out that callback methods support async functions.
Copy file name to clipboardExpand all lines: docs/QUnit/test.only.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ When debugging a larger area of code, you may want to _only_ run all tests withi
41
41
| [QUnit 2.12](https://github.com/qunitjs/qunit/releases/tag/2.12.0) | The `QUnit.only()` method was renamed to `QUnit.test.only()`.<br/>Use of `QUnit.only()` remains supported as an alias.
42
42
| [QUnit 1.20](https://github.com/qunitjs/qunit/releases/tag/1.20.0) | The `QUnit.only()` method was introduced.
43
43
44
-
### Example
44
+
### Examples
45
45
46
46
How to use `QUnit.test.only` to filter which tests are run.
Copy file name to clipboardExpand all lines: docs/QUnit/test.skip.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ As a codebase becomes bigger, you may sometimes want to temporarily disable an e
33
33
| [QUnit 2.12](https://github.com/qunitjs/qunit/releases/tag/2.12.0) | The `QUnit.skip()` method was renamed to `QUnit.test.skip()`.<br/>Use of `QUnit.skip()` remains supported as an alias.
34
34
| [QUnit 1.16](https://github.com/qunitjs/qunit/releases/tag/1.16.0) | The `QUnit.skip()` method was introduced.
35
35
36
-
### Example
36
+
### Examples
37
37
38
38
How to use `skip` as a placeholder for future or temporarily broken tests.
Copy file name to clipboardExpand all lines: docs/QUnit/test.todo.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ You can also use [`QUnit.module.todo()`](./module.md) to manage the "todo" state
39
39
| [QUnit 2.12](https://github.com/qunitjs/qunit/releases/tag/2.12.0) | The `QUnit.todo()` method was renamed to `QUnit.test.todo()`.<br/>Use of `QUnit.todo()` remains supported as an alias.
40
40
| [QUnit 2.2](https://github.com/qunitjs/qunit/releases/tag/2.2.0) | The `QUnit.todo()` method was introduced.
41
41
42
-
### Example
42
+
### Examples
43
43
44
44
How to use `QUnit.test.todo` to denote code that is still under development.
assert.true( true, "test resumed from async operation 1" );
59
+
fetchDouble( 3, res=> {
60
+
assert.strictEqual( res, 6, "double of 3" );
54
61
done1();
55
-
}, 500);
56
-
setTimeout(function() {
57
-
assert.true( true, "test resumed from async operation 2" );
62
+
});
63
+
fetchDouble( 9, res=> {
64
+
assert.strictEqual( res, 18, "double of 9" );
58
65
done2();
59
-
}, 150);
66
+
});
60
67
});
61
68
```
62
69
63
-
Set up an async test three exit points. Each `done()` call adds up to the `acceptCallCount`. After three calls, the test is done.
70
+
##### Example: Require multiple calls
71
+
72
+
The `acceptCallCount` parameter can be used to require multiple calls to the same callback. In the below exxample, the test passes after exactly three calls.
The `equal` assertion uses the simple comparison operator (`==`) to compare the actual and expected arguments. When they are equal, the assertion passes; otherwise, it fails. When it fails, both actual and expected values are displayed in the test result, in addition to a given message.
27
27
28
+
This method is similar to the `assertEquals()` method found in xUnit-style frameworks.
29
+
28
30
[`notEqual()`](./notEqual.md) can be used to explicitly test inequality.
29
31
30
32
[`strictEqual()`](./strictEqual.md) can be used to test strict equality.
0 commit comments