forked from ember-cli/ember-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As of [email protected] (and [email protected]) the testing blueprints are automatically emitting emberjs/rfcs#232 or emberjs/rfcs#268 compatible output. With those, these helpers are no longer used for new apps. Existing apps should only delete these files once they have migrated to the new testing system...
- Loading branch information
Showing
15 changed files
with
67 additions
and
193 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
blueprints/app/files/tests/helpers/module-for-acceptance.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
5 changes: 0 additions & 5 deletions
5
blueprints/module-unification-app/files/tests/helpers/destroy-app.js
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
blueprints/module-unification-app/files/tests/helpers/module-for-acceptance.js
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
blueprints/module-unification-app/files/tests/helpers/start-app.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 13 additions & 21 deletions
34
tests/fixtures/addon/component-with-template/tests/acceptance/main-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
import Ember from 'ember'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Acceptance', { | ||
beforeEach() { | ||
this.application = startApp(); | ||
}, | ||
afterEach() { | ||
destroyApp(this.application); | ||
} | ||
}); | ||
module('Acceptance', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('renders properly', function(assert) { | ||
visit('/'); | ||
test('renders properly', async function(assert) { | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
var element = find('.basic-thing'); | ||
assert.equal(element.first().text().trim(), 'WOOT!!'); | ||
var element = this.element.querySelector('.basic-thing'); | ||
assert.equal(element.textContent.trim(), 'WOOT!!'); | ||
}); | ||
}); | ||
|
||
test('renders imported component', function(assert) { | ||
visit('/'); | ||
test('renders imported component', async function(assert) { | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
var element = find('.second-thing'); | ||
assert.equal(element.first().text().trim(), 'SECOND!!'); | ||
var element = this.element.querySelector('.second-thing'); | ||
assert.equal(element.textContent.trim(), 'SECOND!!'); | ||
}); | ||
}); |
33 changes: 12 additions & 21 deletions
33
tests/fixtures/addon/kitchen-sink/tests/acceptance/main-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,23 @@ | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit } from '@ember/test-helpers'; | ||
import truthyHelper from 'kitchen-sink/test-support/helper'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Acceptance', { | ||
beforeEach() { | ||
this.application = startApp(); | ||
}, | ||
afterEach() { | ||
destroyApp(this.application); | ||
} | ||
}); | ||
module('Acceptance', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('renders properly', function(assert) { | ||
visit('/'); | ||
test('renders properly', async function(assert) { | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
var element = find('.basic-thing'); | ||
assert.equal(element.first().text().trim(), 'WOOT!!'); | ||
var element = this.element.querySelector('.basic-thing'); | ||
assert.equal(element.textContent.trim(), 'WOOT!!'); | ||
assert.ok(truthyHelper(), 'addon-test-support helper'); | ||
}); | ||
}); | ||
|
||
test('renders imported component', function(assert) { | ||
visit('/'); | ||
test('renders imported component', async function(assert) { | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
var element = find('.second-thing'); | ||
assert.equal(element.first().text().trim(), 'SECOND!!'); | ||
var element = this.element.querySelector('.second-thing'); | ||
assert.equal(element.textContent.trim(), 'SECOND!!'); | ||
}); | ||
}); |
24 changes: 8 additions & 16 deletions
24
tests/fixtures/brocfile-tests/default-development/tests/integration/app-boots-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
import Ember from 'ember'; | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('default-development - Integration', { | ||
beforeEach() { | ||
this.application = startApp(); | ||
}, | ||
afterEach() { | ||
destroyApp(this.application); | ||
} | ||
}); | ||
|
||
test('the application boots properly', function(assert) { | ||
assert.expect(1); | ||
module('default-development - Integration', function(hook) { | ||
setupApplicationTest(hooks); | ||
|
||
visit('/'); | ||
test('renders properly', async function(assert) { | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
assert.ok(Ember.$('.ember-view').length > 0); | ||
var elements = this.element.querySelectorAll('.ember-view'); | ||
assert.ok(elements.length > 0); | ||
}); | ||
}); |
24 changes: 9 additions & 15 deletions
24
tests/fixtures/brocfile-tests/pods-templates/tests/integration/pods-template-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
import Ember from 'ember'; | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('pods based templates', { | ||
beforeEach() { | ||
this.application = startApp(); | ||
}, | ||
afterEach() { | ||
destroyApp(this.application); | ||
} | ||
}); | ||
module('pods based templates', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('the application boots properly with pods based templates', function(assert) { | ||
assert.expect(1); | ||
test('the application boots properly with pods based templates', async function(assert) { | ||
assert.expect(1); | ||
|
||
visit('/'); | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
assert.equal(Ember.$('#title').text(), 'ZOMG, PODS WORKS!!'); | ||
let actual = this.element.querySelector('#title').textContent | ||
assert.equal(actual, 'ZOMG, PODS WORKS!!'); | ||
}); | ||
}); |
25 changes: 9 additions & 16 deletions
25
...ixtures/brocfile-tests/pods-with-prefix-templates/tests/integration/pods-template-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
import Ember from 'ember'; | ||
import startApp from '../helpers/start-app'; | ||
import destroyApp from '../helpers/destroy-app'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('pods based templates', { | ||
beforeEach() { | ||
this.application = startApp(); | ||
}, | ||
afterEach() { | ||
destroyApp(this.application); | ||
} | ||
}); | ||
|
||
module('pods based templates', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('the application boots properly with pods based templates with a podModulePrefix set', function(assert) { | ||
assert.expect(1); | ||
test('the application boots properly with pods based templates with a podModulePrefix set', async function(assert) { | ||
assert.expect(1); | ||
|
||
visit('/'); | ||
await visit('/'); | ||
|
||
andThen(function() { | ||
assert.equal(Ember.$('#title').text(), 'ZOMG, PODS WORKS!!'); | ||
let actual = this.element.querySelector('#title').textContent | ||
assert.equal(actual, 'ZOMG, PODS WORKS!!'); | ||
}); | ||
}); |
33 changes: 15 additions & 18 deletions
33
tests/fixtures/smoke-tests/passing-test/tests/acceptance/acceptance-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import moduleForAcceptance from '../helpers/module-for-acceptance'; | ||
import QUnit from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import QUnit, { module, test } from 'qunit'; | ||
|
||
let application, firstArgument; | ||
let firstArgument; | ||
|
||
moduleForAcceptance('Module', { | ||
beforeEach(assert) { | ||
application = this.application; | ||
firstArgument = assert; | ||
}, | ||
module('Module', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
afterEach() { | ||
console.log('afterEach called'); | ||
} | ||
}); | ||
hooks.beforeEach(function(assert) { | ||
firstArgument = assert; | ||
}); | ||
|
||
QUnit.test('it works', function(assert) { | ||
assert.ok(application, 'beforeEach binds to the setup context'); | ||
assert.ok( | ||
Object.getPrototypeOf(firstArgument) === QUnit.assert, | ||
'first argument is QUnit assert' | ||
); | ||
test('it works', function(assert) { | ||
assert.ok(this.owner, 'setupApplicationTest binds to the context'); | ||
assert.ok( | ||
Object.getPrototypeOf(firstArgument) === QUnit.assert, | ||
'first argument is QUnit assert' | ||
); | ||
}); | ||
}); |