1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | declare module 'ember-test-helpers' {
|
22 | import Ember from 'ember';
|
23 | import { TemplateFactory } from 'htmlbars-inline-precompile';
|
24 | import RSVP from 'rsvp';
|
25 |
|
26 | interface ModuleCallbacks {
|
27 | integration?: boolean | undefined;
|
28 | unit?: boolean | undefined;
|
29 | needs?: string[] | undefined;
|
30 |
|
31 | beforeSetup?(assert?: any): void;
|
32 | setup?(assert?: any): void;
|
33 | teardown?(assert?: any): void;
|
34 | afterTeardown?(assert?: any): void;
|
35 |
|
36 | [key: string]: any;
|
37 | }
|
38 |
|
39 | interface TestContext {
|
40 | get(key: string): any;
|
41 | getProperties<K extends string>(...keys: K[]): Pick<any, K>;
|
42 | set<V>(key: string, value: V): V;
|
43 | setProperties<P extends { [key: string]: any }>(hash: P): P;
|
44 | on(actionName: string, handler: (this: TestContext, ...args: any[]) => any): void;
|
45 | send(actionName: string): void;
|
46 | $: JQueryStatic;
|
47 | subject(options?: {}): any;
|
48 | render(template?: string | string[] | TemplateFactory): Promise<void>;
|
49 | clearRender(): void;
|
50 | registry: Ember.Registry;
|
51 | container: Ember.Container;
|
52 | dispatcher: Ember.EventDispatcher;
|
53 | application: Ember.Application;
|
54 | register(fullName: string, factory: any): void;
|
55 | factory(fullName: string): any;
|
56 | inject: {
|
57 | controller(name: string, options?: { as: string }): any;
|
58 | service(name: string, options?: { as: string }): any;
|
59 | };
|
60 | owner: Ember.ApplicationInstance & {
|
61 | factoryFor(fullName: string, options?: {}): any;
|
62 | };
|
63 | pauseTest(): Promise<void>;
|
64 | resumeTest(): void;
|
65 | element: Element;
|
66 | }
|
67 |
|
68 | class TestModule {
|
69 | constructor(name: string, callbacks?: ModuleCallbacks);
|
70 | constructor(name: string, description?: string, callbacks?: ModuleCallbacks);
|
71 |
|
72 | name: string;
|
73 | subjectName: string;
|
74 | description: string;
|
75 | isIntegration: boolean;
|
76 | callbacks: ModuleCallbacks;
|
77 | context: TestContext;
|
78 | resolver: Ember.Resolver;
|
79 |
|
80 | setup(assert?: any): RSVP.Promise<void>;
|
81 | teardown(assert?: any): RSVP.Promise<void>;
|
82 | getContext(): TestContext;
|
83 | setContext(context: TestContext): void;
|
84 | }
|
85 |
|
86 | class TestModuleForAcceptance extends TestModule {}
|
87 | class TestModuleForIntegration extends TestModule {}
|
88 | class TestModuleForComponent extends TestModule {}
|
89 | class TestModuleForModel extends TestModule {}
|
90 |
|
91 | function getContext(): TestContext | undefined;
|
92 | function setContext(context: TestContext): void;
|
93 | function unsetContext(): void;
|
94 | function setResolver(resolver: Ember.Resolver): void;
|
95 | }
|
96 |
|
97 | declare module 'ember-test-helpers/wait' {
|
98 | import RSVP from 'rsvp';
|
99 |
|
100 | interface WaitOptions {
|
101 | waitForTimers?: boolean | undefined;
|
102 | waitForAJAX?: boolean | undefined;
|
103 | waitForWaiters?: boolean | undefined;
|
104 | }
|
105 |
|
106 | export default function wait(options?: WaitOptions): RSVP.Promise<void>;
|
107 | }
|
108 |
|
109 | declare module 'ember-test-helpers/has-ember-version' {
|
110 | export default function hasEmberVersion(major: number, minor: number): boolean;
|
111 | }
|