DefinitelyTyped/types/ember-testing-helpers/index.d.ts
Chris Krycho dfa4555106 Update Ember, RSVP, and Ember testing helpers. (#20301)
* Update RSVP to 4.0, to implement PromiseLike<T>.

- RSVP Promises can now be used with `async` and `await`.
- RSVP types now match what is in RSVP 4.0.

* Update ember-testing-helpers for fixed RSVP.

* Ember.js: correctly represent most of the framework.

- Capture the actual behavior of most of the framework, including computed
  properties, custom getters and setters and the custom Object model more
  generally, prototype extension via `.extend`, and the mixin pattern.
- Support the new modules API alongside the global API.
- Add extensive tests.
- Update inline documentation.
- Use the new, async/await compatible RSVP definitions.

* Ember/RSVP: drop .prettierrc files.

* Drop types/rsvp/assert.ts -- stick to just rsvp-test.ts.

* Fix ember-testing-helpers-tests on top of module itself.

* Fix RSVP import in ember-testing-helpers.

* Fix 'typeRoots', set ember-testing-helpers to use TS 2.4.

* Fix missing 'types' compiler option.

* Fix errors caught by dtslint.

* A few more tslint tweaks.

* Fix account link in ember-testing-helpers authorship.

* Disable strictFunctionTypes for Ember, RSVP.

* fix array.reduce signature conflict in ts@next
2017-10-13 03:13:17 -07:00

70 lines
3.3 KiB
TypeScript

// Type definitions for ember-testing/lib/helpers
// Project: https://github.com/emberjs/ember.js/tree/master/packages/ember-testing/lib/helpers
// Definitions by: Chris Krycho <https://github.com/chriskrycho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// Note that these are distributed separately because they represent a discrete
// set of functionality, and as globally-injected items (as of Ember 2.13), are
// not easily or straightforwardly exported from the Ember type definitions.
/// <reference types="jquery" />
import RSVP from 'rsvp';
type KeyEventType = 'keydown' | 'keyup' | 'keypress';
type WaitResult<T> = RSVP.Promise<T>;
declare global {
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/and_then.js
function andThen<T>(callback: (...args: any[]) => T): RSVP.Promise<T>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/click.js
function click(selector: string, context?: Object): WaitResult<void>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_path.js
function currentPath(): string;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_route_name.js
function currentRouteName(): string;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/current_url.js
function currentURL(): string;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/fill_in.js
function fillIn(selector: string, context: Object, text: string): WaitResult<void>;
function fillIn(selector: string, text: string): WaitResult<void>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/find.js
function find(selector: string, context?: Object): JQuery<Node>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/find_with_assert.js
function findWithAssert(selector: string, context?: Object): JQuery<Node>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/key_event.js
function keyEvent(selector: string, type: KeyEventType, keyCode: number): WaitResult<void>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/pause_test.js
function pauseTest(): RSVP.Promise<{}>;
function resumeTest(): void;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/trigger_event.js
function triggerEvent(
selector: string,
context: Object,
type: string,
options: Object
): WaitResult<void>;
function triggerEvent(selector: string, context: Object, type: string): WaitResult<void>;
function triggerEvent(selector: string, type: string, options: Object): WaitResult<void>;
function triggerEvent(selector: string, type: string): WaitResult<void>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/visit.js
function visit<T>(route: string): WaitResult<void>;
// https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/helpers/wait.js
function wait<T>(value: T): WaitResult<T>;
}
export {};