forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__test__.js
36 lines (28 loc) · 1.22 KB
/
__test__.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<% if (testType === 'integration') { %>import { module, test } from 'qunit';
import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>
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`<%= selfCloseComponent(componentName) %>`);
assert.dom(this.element).hasText('');
// Template block usage:
await render(hbs`
<%= openComponent(componentName) %>
template block text
<%= closeComponent(componentName) %>
`);
assert.dom(this.element).hasText('template block text');
});
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
import { setupTest } from '<%= modulePrefix %>/tests/helpers';
module('<%= friendlyTestDescription %>', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
assert.ok(component);
});
});<% } %>