From d024c4c5ebb704a32065b1632d4426f07084ec4a Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Thu, 10 Jan 2019 14:07:08 -0500 Subject: [PATCH] [ember-qunit] Add `options` parameter to `setupTest` and friends --- types/ember-qunit/ember-qunit-tests.ts | 7 +++++++ types/ember-qunit/index.d.ts | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/types/ember-qunit/ember-qunit-tests.ts b/types/ember-qunit/ember-qunit-tests.ts index acd9650f98..9e85253ae9 100644 --- a/types/ember-qunit/ember-qunit-tests.ts +++ b/types/ember-qunit/ember-qunit-tests.ts @@ -139,4 +139,11 @@ module('foo service', function(hooks) { setupTest(hooks); }); +// RFC-232 equivalent of https://github.com/ember-engines/ember-engines#unitintegration-testing-for-in-repo-engines +module('engine foo component', function(hooks) { + setupTest(hooks, { + resolver: Ember.Resolver.create() + }); +}); + start(); diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index 6b3188fdfc..1ce6f90483 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Derek Wickern // Mike North // Steve Calvert +// Dan Freeman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -46,6 +47,13 @@ declare module 'ember-qunit' { */ export function setResolver(resolver: Ember.Resolver): void; + interface SetupTestOptions { + /** + * The resolver to use when instantiating container-managed entities in the test. + */ + resolver?: Ember.Resolver; + } + /** * Sets up acceptance tests. * @@ -58,7 +66,7 @@ declare module 'ember-qunit' { * * `this.pauseTest` and `this.resumeTest` - allow easy pausing/resuming of tests. * * `this.element` which returns the DOM element representing the application's root element. */ - export function setupApplicationTest(hooks: NestedHooks): void; + export function setupApplicationTest(hooks: NestedHooks, options?: SetupTestOptions): void; /** * Sets up tests that need to render snippets of templates. @@ -79,7 +87,7 @@ declare module 'ember-qunit' { * * this.$(...) - When jQuery is present, executes a jQuery selector with * the current this.element as its root */ - export function setupRenderingTest(hooks: NestedHooks): void; + export function setupRenderingTest(hooks: NestedHooks, options?: SetupTestOptions): void; /** * Sets up tests that do not need to render snippets of templates. @@ -94,7 +102,7 @@ declare module 'ember-qunit' { * * this.set / this.setProperties - Allows setting values on the test context. * * this.get / this.getProperties - Retrieves values from the test context. */ - export function setupTest(hooks: NestedHooks): void; + export function setupTest(hooks: NestedHooks, options?: SetupTestOptions): void; export class QUnitAdapter extends Ember.Test.Adapter { }