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