-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blueprints/component-test: Add RFC232 variants
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
blueprints/component-test/qunit-rfc-232-files/tests/__testType__/__path__/__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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<% if (testType === 'integration') { %>import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
module('<%= friendlyTestDescription %>', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.set('myAction', function(val) { ... }); | ||
|
||
await render(hbs`{{<%= componentPathName %>}}`); | ||
|
||
assert.equal(this.element.textContent.trim(), ''); | ||
|
||
// Template block usage: | ||
await(hbs` | ||
{{#<%= componentPathName %>}} | ||
template block text | ||
{{/<%= componentPathName %>}} | ||
`); | ||
|
||
assert.equal(this.element.textContent.trim(), 'template block text'); | ||
}); | ||
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('<%= friendlyTestDescription %>', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('it exists', function(assert) { | ||
let component = this.owner.factoryFor('component:<%= componentPathName %>').create(); | ||
assert.ok(component); | ||
}); | ||
});<% } %> |
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('Unit | Component | x foo', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('it exists', function(assert) { | ||
let component = this.owner.factoryFor('component:x-foo').create(); | ||
assert.ok(component); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
module('Integration | Component | x foo', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.set('myAction', function(val) { ... }); | ||
|
||
await render(hbs`{{x-foo}}`); | ||
|
||
assert.equal(this.element.textContent.trim(), ''); | ||
|
||
// Template block usage: | ||
await(hbs` | ||
{{#x-foo}} | ||
template block text | ||
{{/x-foo}} | ||
`); | ||
|
||
assert.equal(this.element.textContent.trim(), 'template block text'); | ||
}); | ||
}); |