UNPKG

2.25 kBTypeScriptView Raw
1import { BaseContext, TestContext } from './setup-context';
2export interface ApplicationTestContext extends TestContext {
3 element?: Element | null;
4}
5export declare function isApplicationTestContext(context: BaseContext): context is ApplicationTestContext;
6/**
7 Determines if we have any pending router transitions (used to determine `settled` state)
8
9 @public
10 @returns {(boolean|null)} if there are pending transitions
11*/
12export declare function hasPendingTransitions(): boolean | null;
13/**
14 Setup the current router instance with settledness tracking. Generally speaking this
15 is done automatically (during a `visit('/some-url')` invocation), but under some
16 circumstances (e.g. a non-application test where you manually call `this.owner.setupRouter()`)
17 you may want to call it yourself.
18
19 @public
20 */
21export declare function setupRouterSettlednessTracking(): void;
22/**
23 Navigate the application to the provided URL.
24
25 @public
26 @param {string} url The URL to visit (e.g. `/posts`)
27 @param {object} options app boot options
28 @returns {Promise<void>} resolves when settled
29
30 @example
31 <caption>
32 Visiting the route for post 1.
33 </caption>
34 await visit('/posts/1');
35
36 @example
37 <caption>
38 Visiting the route for post 1 while also providing the `rootElement` app boot option.
39 </caption>
40 await visit('/', { rootElement: '#container' });
41*/
42export declare function visit(url: string, options?: Record<string, unknown>): Promise<void>;
43/**
44 @public
45 @returns {string} the currently active route name
46*/
47export declare function currentRouteName(): string;
48/**
49 @public
50 @returns {string} the applications current url
51*/
52export declare function currentURL(): string;
53/**
54 Used by test framework addons to setup the provided context for working with
55 an application (e.g. routing).
56
57 `setupContext` must have been run on the provided context prior to calling
58 `setupApplicationContext`.
59
60 Sets up the basic framework used by application tests.
61
62 @public
63 @param {Object} context the context to setup
64 @returns {Promise<void>} resolves when the context is set up
65*/
66export default function setupApplicationContext(context: TestContext): Promise<void>;
67//# sourceMappingURL=setup-application-context.d.ts.map
\No newline at end of file