UNPKG

1.32 kBTypeScriptView Raw
1declare module 'ember-testing/lib/helpers/wait' {
2 import type Application from '@ember/application';
3 /**
4 Causes the run loop to process any pending events. This is used to ensure that
5 any async operations from other helpers (or your assertions) have been processed.
6
7 This is most often used as the return value for the helper functions (see 'click',
8 'fillIn','visit',etc). However, there is a method to register a test helper which
9 utilizes this method without the need to actually call `wait()` in your helpers.
10
11 The `wait` helper is built into `registerAsyncHelper` by default. You will not need
12 to `return app.testHelpers.wait();` - the wait behavior is provided for you.
13
14 Example:
15
16 ```javascript
17 import { registerAsyncHelper } from '@ember/test';
18
19 registerAsyncHelper('loginUser', function(app, username, password) {
20 visit('secured/path/here')
21 .fillIn('#username', username)
22 .fillIn('#password', password)
23 .click('.submit');
24 });
25 ```
26
27 @method wait
28 @param {Object} value The value to be returned.
29 @return {RSVP.Promise<any>} Promise that resolves to the passed value.
30 @public
31 @since 1.0.0
32 */
33 export default function wait<T>(app: Application, value: T): Promise<T>;
34}