This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All: Step 1 of site unification, import api content
* Import content from https://github.com/qunitjs/qunit/tree/8a6723f7e2b4fad41779734301d16135c9e397ad/docs into api/ directory. * Modify the imported pages to add a `redirect_from` entry reflecting their previous URL on the api.qunitjs.com domain. For example, api.qunitjs.com/QUnit/test/ is imported here as qunitjs.com/api/QUnit/test/ with a redirect from qunitjs.com/QUnit/test/ This way, once we redirect api.qunitjs.com to qunitjs.com, the old path will be recognised and redirected accordingly from api.qunitjs.com/QUnit/test/ to qunitjs.com/api/QUnit/test/. * Modify pre-existing pages to refer to the in-repo Markdown files instead of raw URLs. This aids local testing, as well as makes sure that jekyll builds can automatically validate that all linked pages exist, and will output links with the canonical URL. Ref qunitjs/qunit#1754
- Loading branch information
Showing
89 changed files
with
4,262 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
- group: main | ||
expand: initial | ||
|
||
- group: assert | ||
|
||
- group: callbacks | ||
|
||
- group: async | ||
# These pages are all in at least one other group. | ||
# It exists for discoverability, but we don't need | ||
# to highlight its pages in two places. | ||
expand: false | ||
|
||
- title: Configuration | ||
group: config | ||
|
||
- group: extension | ||
|
||
- group: deprecated | ||
expand: false | ||
|
||
# - group: removed | ||
# expand: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
layout: page-api | ||
title: QUnit.hooks | ||
excerpt: Add global callbacks to run before or after each test. | ||
groups: | ||
- extension | ||
redirect_from: | ||
- "/QUnit/hooks/" | ||
version_added: "2.18.0" | ||
--- | ||
|
||
`QUnit.hooks.beforeEach( callback )`<br> | ||
`QUnit.hooks.afterEach( callback )` | ||
|
||
Register a global callback to run before or after each test. | ||
|
||
| parameter | description | | ||
|-----------|-------------| | ||
| callback (function) | Callback to execute. Called with an [assert](../assert/index.md) argument. | | ||
|
||
This is the equivalent of applying a `QUnit.module()` hook to all modules and all tests, including global tests that are not associated with any module. | ||
|
||
Similar to module hooks, global hooks support async functions or returning a Promise, which will be waited for before QUnit continues executing tests. Each global hook also has access to the same `assert` object and test context as the [QUnit.test](./test.md) that the hook is running for. | ||
|
||
For more details about hooks, refer to [QUnit.module § Hooks](./module.md#hooks). | ||
|
||
## Examples | ||
|
||
```js | ||
QUnit.hooks.beforeEach(function () { | ||
this.app = new MyApp(); | ||
}); | ||
|
||
QUnit.hooks.afterEach(async function (assert) { | ||
assert.deepEqual([], await this.app.getErrors(), 'MyApp errors'); | ||
|
||
MyApp.reset(); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
layout: group | ||
group: main | ||
title: Main methods | ||
redirect_from: | ||
- "/QUnit/" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
layout: page-api | ||
title: QUnit.load() | ||
excerpt: Inform the test runner that code has finished loading. | ||
groups: | ||
- deprecated | ||
redirect_from: | ||
- "/QUnit/load/" | ||
version_added: "1.0.0" | ||
version_deprecated: "unreleased" | ||
--- | ||
|
||
`QUnit.load()` | ||
|
||
Inform the test runner that your source code and tests have finished loading. | ||
|
||
This method was used in conjunction with the [`QUnit.config.autostart`](../config/autostart.md) option in a web browser, to indicate when your custom way of loading scripts is complete. | ||
|
||
As of [QUnit 2.1.1](https://github.com/qunitjs/qunit/releases/tag/2.1.1), calls to `QUnit.load()` are no longer needed. Existing calls are usually ignored and safe to remove. | ||
|
||
<p class="note note--warning" markdown="1">This method is __deprecated__. Remove call, or replace by a single call to [`QUnit.start()`](./start.md).</p> | ||
|
||
## Changelog | ||
|
||
| UNRELEASED | Deprecated. Use [`QUnit.start()`](./start.md) instead. | ||
| [QUnit 2.1.1](https://github.com/qunitjs/qunit/releases/tag/2.1.1) | `QUnit.start()` no longer requires calling `QUnit.load()` first. | ||
|
||
## Migration guide | ||
|
||
If you still call `QUnit.load()` with QUnit 2.2 or later, the call is usually redundant and safe to remove. | ||
|
||
### If you call both `QUnit.load()` and `QUnit.start()` | ||
|
||
If your project started with QUnit 1.x, and you use `QUnit.config.autostart = false`, then you might be calling both of these methods. In the QUnit 1.x era, [`QUnit.start()`](./start.md) required that you also call `QUnit.load()` first. | ||
|
||
This is no longer needed since [QUnit 2.1.1](https://github.com/qunitjs/qunit/releases/tag/2.1.1), and the call to `QUnit.load()` is safe to remove. | ||
|
||
### If you call `QUnit.load()` | ||
|
||
Prior to QUnit 2.21, the built-in HTML Reporter called `QUnit.load()` from the window.onload event, which in turn gracefully calls `QUnit.start()` if it has not been called already. | ||
|
||
If your test runner works in a similar way, call [`QUnit.start()`](./start.md) instead of `QUnit.load()`. This will solve the deprecation warning and prepares you for QUnit 3. | ||
|
||
### Karma runner | ||
|
||
``` | ||
QUnit.load is deprecated and will be removed in QUnit 3.0. | ||
``` | ||
|
||
If you encounter this warning in Karma output, upgrade to [karma-qunit](https://github.com/karma-runner/karma-qunit) 4.2.0 or later, which [fixes](https://github.com/karma-runner/karma-qunit/pull/184) this warning. |
Oops, something went wrong.