Merge pull request #32040 from dfreeman/ember-qunit-setup-test-options

[ember-qunit] Add `options` parameter to `setupTest` and friends
This commit is contained in:
Daniel Rosenwasser
2019-01-16 11:35:05 -08:00
committed by GitHub
2 changed files with 18 additions and 3 deletions
+7
View File
@@ -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();
+11 -3
View File
@@ -3,6 +3,7 @@
// Definitions by: Derek Wickern <https://github.com/dwickern>
// Mike North <https://github.com/mike-north>
// Steve Calvert <https://github.com/scalvert>
// Dan Freeman <https://github.com/dfreeman>
// 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 { }