document deps
This commit is contained in:
parent
8535331b8a
commit
eceea4addf
3 changed files with 8 additions and 9 deletions
|
|
@ -7,11 +7,9 @@
|
|||
|
||||
---
|
||||
|
||||
This is a testing method to set the `window` object in an environment that does not have it (such as the server).
|
||||
It will normally _not_ be used in an application, as `window` is already available to Mithril.
|
||||
For normal (client-side) use of mithril, this method will not be used.
|
||||
This function overwrites the reference to the `window` object that is used internally by Mithril. It is useful for injecting a mock `window` dependency for the purposes of testing and for running Mithril in non-browser environments. The mock object used by Mithril for its own test suite [can be found in the development repo](https://github.com/lhorie/mithril.js/blob/next/tests/mock.js).
|
||||
|
||||
It is used in Mithril's testing suite, and can be used to supply a mock `window` for browserless testing.
|
||||
By default, Mithril uses `window` itself as the dependency. Note that Mithril only uses the mock object for browser APIs such as the DOM API and `requestAnimationFrame`, but relies on the environment for ECMAScript features like `Object.keys`.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -42,14 +40,14 @@ where:
|
|||
|
||||
- **Object Window**
|
||||
|
||||
This should be a mock of the `window` object.
|
||||
This should be either `window` or a mock of the `window` object.
|
||||
|
||||
Mithril uses certain `window` methods that will need to be made available for complete test coverage, depending on your application:
|
||||
|
||||
- `window.document`
|
||||
- Mithril also uses certain methods on the DOM node object
|
||||
- Mithril also uses certain methods on the DOM node object
|
||||
- `window.requestAnimationFrame`/`window.cancelAnimationFrame`
|
||||
- Falls back to `window.setTimeout`/`window.clearTimeout`
|
||||
- Falls back to `window.setTimeout`/`window.clearTimeout`
|
||||
- `window.location`
|
||||
- `window.history`
|
||||
- `window.scrollTo`
|
||||
|
|
@ -57,5 +55,5 @@ where:
|
|||
|
||||
- **returns** Window
|
||||
|
||||
The returned window is the same as that passed in.
|
||||
The returned window is the same as what is passed in.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue