UNPKG

3.04 kBTypeScriptView Raw
1// Note that these are distributed separately because they represent a discrete
2// set of functionality, and as globally-injected items (as of Ember 2.13), are
3// not easily or straightforwardly exported from the Ember type definitions.
4
5/// <reference types="jquery" />
6
7import RSVP from "rsvp";
8
9type KeyEventType = "keydown" | "keyup" | "keypress";
10type WaitResult<T> = RSVP.Promise<T>;
11
12declare global {
13 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/and_then.js
14 function andThen<T>(callback: (...args: any[]) => T): RSVP.Promise<T>;
15
16 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/click.js
17 function click(selector: string, context?: Object): WaitResult<void>;
18
19 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_path.js
20 function currentPath(): string;
21
22 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_route_name.js
23 function currentRouteName(): string;
24
25 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_url.js
26 function currentURL(): string;
27
28 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/fill_in.js
29 function fillIn(selector: string, context: Object, text: string): WaitResult<void>;
30 function fillIn(selector: string, text: string): WaitResult<void>;
31
32 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/find.js
33 function find(selector: string, context?: Object): JQuery<Node>;
34
35 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/find_with_assert.js
36 function findWithAssert(selector: string, context?: Object): JQuery<Node>;
37
38 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/key_event.js
39 function keyEvent(selector: string, type: KeyEventType, keyCode: number): WaitResult<void>;
40
41 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/pause_test.js
42 function pauseTest(): RSVP.Promise<{}>;
43 function resumeTest(): void;
44
45 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/trigger_event.js
46 function triggerEvent(
47 selector: string,
48 context: Object,
49 type: string,
50 options: Object,
51 ): WaitResult<void>;
52 function triggerEvent(selector: string, context: Object, type: string): WaitResult<void>;
53 function triggerEvent(selector: string, type: string, options: Object): WaitResult<void>;
54 function triggerEvent(selector: string, type: string): WaitResult<void>;
55
56 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/visit.js
57 function visit<T>(route: string): WaitResult<void>;
58
59 // https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/wait.js
60 function wait<T>(value: T): WaitResult<T>;
61}
62
63export {};