1 | declare module 'ember-testing/lib/test/waiters' {
|
2 | /**
|
3 | This allows ember-testing to play nicely with other asynchronous
|
4 | events, such as an application that is waiting for a CSS3
|
5 | transition or an IndexDB transaction. The waiter runs periodically
|
6 | after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
|
7 | until the returning result is truthy. After the waiters finish, the next async helper
|
8 | is executed and the process repeats.
|
9 |
|
10 | For example:
|
11 |
|
12 | ```javascript
|
13 | import { registerWaiter } from '@ember/test';
|
14 |
|
15 | registerWaiter(function() {
|
16 | return myPendingTransactions() === 0;
|
17 | });
|
18 | ```
|
19 | The `context` argument allows you to optionally specify the `this`
|
20 | with which your callback will be invoked.
|
21 |
|
22 | For example:
|
23 |
|
24 | ```javascript
|
25 | import { registerWaiter } from '@ember/test';
|
26 |
|
27 | registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
28 | ```
|
29 |
|
30 | @public
|
31 | @for @ember/test
|
32 | @static
|
33 | @method registerWaiter
|
34 | @param {Object} context (optional)
|
35 | @param {Function} callback
|
36 | @since 1.2.0
|
37 | */
|
38 | export function registerWaiter<T>(context: T, callback: (this: T) => unknown): void;
|
39 | export function registerWaiter(callback: (this: null) => unknown): void;
|
40 | /**
|
41 | `unregisterWaiter` is used to unregister a callback that was
|
42 | registered with `registerWaiter`.
|
43 |
|
44 | @public
|
45 | @for @ember/test
|
46 | @static
|
47 | @method unregisterWaiter
|
48 | @param {Object} context (optional)
|
49 | @param {Function} callback
|
50 | @since 1.2.0
|
51 | */
|
52 | export function unregisterWaiter(context: unknown, callback: unknown): void;
|
53 | /**
|
54 | Iterates through each registered test waiter, and invokes
|
55 | its callback. If any waiter returns false, this method will return
|
56 | true indicating that the waiters have not settled yet.
|
57 |
|
58 | This is generally used internally from the acceptance/integration test
|
59 | infrastructure.
|
60 |
|
61 | @public
|
62 | @for @ember/test
|
63 | @static
|
64 | @method checkWaiters
|
65 | */
|
66 | export function checkWaiters(): boolean;
|
67 | }
|