diff --git a/addon-test-support/index.js b/addon-test-support/index.js
index e57e409b5..a72c921e7 100644
--- a/addon-test-support/index.js
+++ b/addon-test-support/index.js
@@ -2,9 +2,6 @@ export { default as TestModule } from './test-module';
export {
default as TestModuleForAcceptance,
} from './test-module-for-acceptance';
-export {
- default as TestModuleForIntegration,
-} from './test-module-for-integration';
export { default as TestModuleForComponent } from './test-module-for-component';
export { default as TestModuleForModel } from './test-module-for-model';
export { getContext, setContext, unsetContext } from './test-context';
diff --git a/addon-test-support/test-module-for-integration.js b/addon-test-support/test-module-for-integration.js
deleted file mode 100644
index 5d3a7b88c..000000000
--- a/addon-test-support/test-module-for-integration.js
+++ /dev/null
@@ -1,217 +0,0 @@
-import { set } from '@ember/object';
-import { run } from '@ember/runloop';
-import { setOwner } from '@ember/application';
-import EmberRouter from '@ember/routing/router';
-import Ember from 'ember';
-import AbstractTestModule from './abstract-test-module';
-import { getResolver } from './test-resolver';
-import buildRegistry from './build-registry';
-import hasEmberVersion from './has-ember-version';
-import { preGlimmerSetupIntegrationForComponent } from './-legacy-overrides';
-import { setupComponentIntegrationTest } from './test-module-for-component';
-
-const isPreGlimmer = !hasEmberVersion(1, 13);
-
-export default class extends AbstractTestModule {
- constructor() {
- super(...arguments);
- this.resolver = this.callbacks.resolver || getResolver();
- }
-
- initSetupSteps() {
- this.setupSteps = [];
- this.contextualizedSetupSteps = [];
-
- if (this.callbacks.beforeSetup) {
- this.setupSteps.push(this.callbacks.beforeSetup);
- delete this.callbacks.beforeSetup;
- }
-
- this.setupSteps.push(this.setupContainer);
- this.setupSteps.push(this.setupContext);
- this.setupSteps.push(this.setupTestElements);
- this.setupSteps.push(this.setupAJAXListeners);
- this.setupSteps.push(this.setupComponentIntegrationTest);
-
- if (Ember.View && Ember.View.views) {
- this.setupSteps.push(this._aliasViewRegistry);
- }
-
- if (this.callbacks.setup) {
- this.contextualizedSetupSteps.push(this.callbacks.setup);
- delete this.callbacks.setup;
- }
- }
-
- initTeardownSteps() {
- this.teardownSteps = [];
- this.contextualizedTeardownSteps = [];
-
- if (this.callbacks.teardown) {
- this.contextualizedTeardownSteps.push(this.callbacks.teardown);
- delete this.callbacks.teardown;
- }
-
- this.teardownSteps.push(this.teardownContainer);
- this.teardownSteps.push(this.teardownContext);
- this.teardownSteps.push(this.teardownAJAXListeners);
- this.teardownSteps.push(this.teardownComponent);
-
- if (Ember.View && Ember.View.views) {
- this.teardownSteps.push(this._resetViewRegistry);
- }
-
- this.teardownSteps.push(this.teardownTestElements);
-
- if (this.callbacks.afterTeardown) {
- this.teardownSteps.push(this.callbacks.afterTeardown);
- delete this.callbacks.afterTeardown;
- }
- }
-
- setupContainer() {
- var resolver = this.resolver;
- var items = buildRegistry(resolver);
-
- this.container = items.container;
- this.registry = items.registry;
-
- if (hasEmberVersion(1, 13)) {
- var thingToRegisterWith = this.registry || this.container;
- var router = resolver.resolve('router:main');
- router = router || EmberRouter.extend();
- thingToRegisterWith.register('router:main', router);
- }
- }
-
- setupContext() {
- var subjectName = this.subjectName;
- var container = this.container;
-
- var factory = function() {
- return container.factoryFor
- ? container.factoryFor(subjectName)
- : container.lookupFactory(subjectName);
- };
-
- super.setupContext({
- container: this.container,
- registry: this.registry,
- factory: factory,
- register() {
- var target = this.registry || this.container;
- return target.register.apply(target, arguments);
- },
- });
-
- var context = this.context;
-
- if (setOwner) {
- setOwner(context, this.container.owner);
- }
-
- if (Ember.inject) {
- var keys = (Object.keys || keys)(Ember.inject);
- keys.forEach(function(typeName) {
- context.inject[typeName] = function(name, opts) {
- var alias = (opts && opts.as) || name;
- run(function() {
- set(
- context,
- alias,
- context.container.lookup(typeName + ':' + name)
- );
- });
- };
- });
- }
-
- // only setup the injection if we are running against a version
- // of Ember that has `-view-registry:main` (Ember >= 1.12)
- if (
- this.container.factoryFor
- ? this.container.factoryFor('-view-registry:main')
- : this.container.lookupFactory('-view-registry:main')
- ) {
- (this.registry || this.container).injection(
- 'component',
- '_viewRegistry',
- '-view-registry:main'
- );
- }
- }
-
- setupComponentIntegrationTest() {
- if (isPreGlimmer) {
- return preGlimmerSetupIntegrationForComponent.apply(this, arguments);
- } else {
- return setupComponentIntegrationTest.apply(this, arguments);
- }
- }
-
- teardownComponent() {
- var component = this.component;
- if (component) {
- run(function() {
- component.destroy();
- });
- }
- }
-
- teardownContainer() {
- var container = this.container;
- run(function() {
- container.destroy();
- });
- }
-
- // allow arbitrary named factories, like rspec let
- contextualizeCallbacks() {
- var callbacks = this.callbacks;
- var context = this.context;
-
- this.cache = this.cache || {};
- this.cachedCalls = this.cachedCalls || {};
-
- var keys = (Object.keys || keys)(callbacks);
- var keysLength = keys.length;
-
- if (keysLength) {
- for (var i = 0; i < keysLength; i++) {
- this._contextualizeCallback(context, keys[i], context);
- }
- }
- }
-
- _contextualizeCallback(context, key, callbackContext) {
- var _this = this;
- var callbacks = this.callbacks;
- var factory = context.factory;
-
- context[key] = function(options) {
- if (_this.cachedCalls[key]) {
- return _this.cache[key];
- }
-
- var result = callbacks[key].call(callbackContext, options, factory());
-
- _this.cache[key] = result;
- _this.cachedCalls[key] = true;
-
- return result;
- };
- }
-
- _aliasViewRegistry() {
- this._originalGlobalViewRegistry = Ember.View.views;
- var viewRegistry = this.container.lookup('-view-registry:main');
-
- if (viewRegistry) {
- Ember.View.views = viewRegistry;
- }
- }
-
- _resetViewRegistry() {
- Ember.View.views = this._originalGlobalViewRegistry;
- }
-}
diff --git a/tests/unit/test-module-for-integration-test.js b/tests/unit/test-module-for-integration-test.js
deleted file mode 100644
index 3594af46f..000000000
--- a/tests/unit/test-module-for-integration-test.js
+++ /dev/null
@@ -1,353 +0,0 @@
-import QUnit, { test } from 'qunit';
-import TextField from '@ember/component/text-field';
-import { on } from '@ember/object/evented';
-import Component from '@ember/component';
-import EmberObject from '@ember/object';
-import EmberService, { inject as service } from '@ember/service';
-import hasEmberVersion from 'ember-test-helpers/has-ember-version';
-import { TestModuleForIntegration } from 'ember-test-helpers';
-import { setResolverRegistry, createCustomResolver } from '../helpers/resolver';
-import qunitModuleFor from '../helpers/qunit-module-for';
-import hbs from 'htmlbars-inline-precompile';
-import { fireEvent, focus, blur } from '../helpers/events';
-
-const Service = EmberService || EmberObject;
-
-function moduleForIntegration(description, callbacks) {
- var module = new TestModuleForIntegration(description, callbacks);
- qunitModuleFor(module);
-}
-
-moduleForIntegration('Component Integration Tests', {
- beforeSetup() {
- setResolverRegistry({
- 'template:components/my-component': hbs`{{name}}`,
- });
- },
-});
-
-test('it can render a template', function(assert) {
- this.render(hbs`Hello`);
- let actual = this._element.querySelector('span').textContent;
- assert.equal(actual, 'Hello');
-});
-
-if (hasEmberVersion(1, 11)) {
- test('it can render a link-to', function(assert) {
- this.render(hbs`{{link-to 'Hi' 'index'}}`);
- assert.ok(true, 'it renders without fail');
- });
-}
-
-test('it complains if you try to use bare render', function(assert) {
- var self = this;
- assert.throws(function() {
- self.render();
- }, /in a component integration test you must pass a template to `render\(\)`/);
-});
-
-test('it can access the full container', function(assert) {
- this.set('myColor', 'red');
- this.render(hbs`{{my-component name=myColor}}`);
-
- assert.equal(this._element.querySelector('span').textContent, 'red');
- this.set('myColor', 'blue');
- assert.equal(this._element.querySelector('span').textContent, 'blue');
-});
-
-test('it can handle actions', function(assert) {
- var handlerArg;
- this.render(hbs``);
- this.on('didFoo', function(thing) {
- handlerArg = thing;
- });
- this._element.querySelector('button').click();
- assert.equal(handlerArg, 42);
-});
-
-test('it accepts precompiled templates', function(assert) {
- this.render(hbs`Hello`);
- assert.equal(this._element.querySelector('span').textContent, 'Hello');
-});
-
-test('it supports DOM events', function(assert) {
- setResolverRegistry({
- 'component:my-component': Component.extend({
- value: 0,
- layout: hbs`Click to increment!{{value}}`,
- incrementOnClick: on('click', function() {
- this.incrementProperty('value');
- }),
- }),
- });
- this.render(hbs`{{my-component}}`);
- this._element.querySelector('.target').click();
- assert.equal(this._element.querySelector('.value').textContent, '1');
-});
-
-test('it supports updating an input', function(assert) {
- setResolverRegistry({
- 'component:my-input': TextField.extend({
- value: null,
- }),
- });
- this.render(hbs`{{my-input value=value}}`);
-
- let input = this._element.querySelector('input');
- input.value = '1';
- fireEvent(input, 'change');
- assert.equal(this.get('value'), '1');
-});
-
-test('it supports dom triggered focus events', function(assert) {
- setResolverRegistry({
- 'component:my-input': TextField.extend({
- _onInit: on('init', function() {
- this.set('value', 'init');
- }),
- focusIn() {
- this.set('value', 'focusin');
- },
- focusOut() {
- this.set('value', 'focusout');
- },
- }),
- });
- this.render(hbs`{{my-input}}`);
- let input = this._element.querySelector('input');
- assert.equal(input.value, 'init');
-
- focus(input);
- assert.equal(input.value, 'focusin');
-
- blur(input);
- assert.equal(input.value, 'focusout');
-});
-
-test('`toString` returns the test name', function(assert) {
- assert.equal(
- this.toString(),
- 'test context for: Component Integration Tests',
- 'toString returns `test context for: name`'
- );
-});
-
-moduleForIntegration('TestModuleForIntegration | render during setup', {
- beforeSetup() {
- setResolverRegistry({
- 'component:my-component': Component.extend({
- value: 0,
- layout: hbs`Click to increment!{{value}}`,
- incrementOnClick: on('click', function() {
- this.incrementProperty('value');
- }),
- }),
- });
- },
- setup() {
- this.render(hbs`{{my-component}}`);
- },
-});
-
-test('it has working events', function(assert) {
- this._element.querySelector('.target').click();
- assert.equal(this._element.querySelector('.value').textContent, '1');
-});
-
-moduleForIntegration('TestModuleForIntegration | context', {
- beforeSetup() {
- setResolverRegistry({
- 'component:my-component': Component.extend({
- layout: hbs`{{foo}}{{bar}}`,
- }),
- });
- },
-});
-
-test('it can set and get properties', function(assert) {
- var setResult = this.set('foo', 1);
-
- if (hasEmberVersion(2, 0)) {
- assert.equal(setResult, '1');
- } else {
- assert.equal(setResult, undefined);
- }
-
- this.render(hbs`{{my-component foo=foo}}`);
- assert.equal(this.get('foo'), '1');
- assert.equal(this._element.querySelector('.foo').textContent, '1');
-});
-
-test('it can setProperties and getProperties', function(assert) {
- var hash = {
- foo: 1,
- bar: 2,
- };
- var setResult = this.setProperties(hash);
-
- if (hasEmberVersion(2, 0)) {
- assert.deepEqual(setResult, hash);
- } else {
- assert.equal(setResult, undefined);
- }
-
- this.render(hbs`{{my-component foo=foo bar=bar}}`);
- var properties = this.getProperties('foo', 'bar');
- assert.equal(properties.foo, '1');
- assert.equal(properties.bar, '2');
- let element = this._element;
- assert.equal(element.querySelector('.foo').textContent, '1');
- assert.equal(element.querySelector('.bar').textContent, '2');
-});
-
-moduleForIntegration('TestModuleForIntegration | register and inject', {});
-
-test('can register a component', function(assert) {
- this.register(
- 'component:x-foo',
- Component.extend({
- classNames: ['i-am-x-foo'],
- })
- );
- this.render(hbs`{{x-foo}}`);
- assert.equal(
- this._element.querySelectorAll('.i-am-x-foo').length,
- 1,
- 'found i-am-x-foo'
- );
-});
-
-test('can register a service', function(assert) {
- this.register(
- 'component:x-foo',
- Component.extend({
- unicorn: service(),
- layout: hbs`{{unicorn.sparkliness}}`,
- })
- );
- this.register(
- 'service:unicorn',
- Service.extend({
- sparkliness: 'extreme',
- })
- );
- this.render(hbs`{{x-foo}}`);
- assert.equal(this._element.querySelector('.x-foo').textContent, 'extreme');
-});
-
-test('can inject a service directly into test context', function(assert) {
- this.register(
- 'component:x-foo',
- Component.extend({
- unicorn: service(),
- layout: hbs`{{unicorn.sparkliness}}`,
- })
- );
- this.register(
- 'service:unicorn',
- Service.extend({
- sparkliness: 'extreme',
- })
- );
- this.inject.service('unicorn');
- this.render(hbs`{{x-foo}}`);
- assert.equal(this._element.querySelector('.x-foo').textContent, 'extreme');
- this.set('unicorn.sparkliness', 'amazing');
- assert.equal(this._element.querySelector('.x-foo').textContent, 'amazing');
-});
-
-test('can inject a service directly into test context, with aliased name', function(
- assert
-) {
- this.register(
- 'component:x-foo',
- Component.extend({
- unicorn: service(),
- layout: hbs`{{unicorn.sparkliness}}`,
- })
- );
- this.register(
- 'service:unicorn',
- Service.extend({
- sparkliness: 'extreme',
- })
- );
- this.inject.service('unicorn', { as: 'hornedBeast' });
- this.render(hbs`{{x-foo}}`);
-
- assert.equal(this._element.querySelector('.x-foo').textContent, 'extreme');
- this.set('hornedBeast.sparkliness', 'amazing');
- assert.equal(this._element.querySelector('.x-foo').textContent, 'amazing');
-});
-
-moduleForIntegration('TestModuleForIntegration | willDestoryElement', {
- beforeSetup() {
- setResolverRegistry({
- 'component:my-component': Component.extend({
- willDestroyElement() {
- let { assert } = QUnit.config.current;
-
- assert.equal(
- this._state,
- 'inDOM',
- 'still in dom during willDestroyElement'
- );
- assert.ok(
- document.contains(this.element),
- 'component element still contained within `document`'
- );
- },
- }),
- });
- },
-});
-
-test('still in DOM in willDestroyElement', function(assert) {
- assert.expect(2);
- this.render(hbs`{{my-component}}`);
-});
-
-moduleForIntegration(
- 'TestModuleForIntegration: force willDestroyElement via clearRender',
- {
- beforeSetup() {
- setResolverRegistry({});
- },
- }
-);
-
-test('still in DOM in willDestroyElement', function(assert) {
- assert.expect(1);
-
- let willDestroyCalled = false;
- this.register(
- 'component:x-button',
- Component.extend({
- willDestroyElement() {
- willDestroyCalled = true;
- },
- })
- );
-
- this.render(hbs`{{x-button}}`);
- this.clearRender();
-
- assert.ok(
- willDestroyCalled,
- 'can add assertions after willDestroyElement is called'
- );
-});
-
-moduleForIntegration('TestModuleForIntegration | custom resolver', {
- resolver: createCustomResolver({
- 'component:y-foo': Component.extend({
- name: 'Y u no foo?!',
- }),
- 'template:components/y-foo': hbs`{{name}}`,
- }),
-});
-
-test('can render with a custom resolver', function(assert) {
- this.render(hbs`{{y-foo}}`);
- assert.equal(this._element.textContent, 'Y u no foo?!', 'rendered properly');
-});