forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__test__.js
38 lines (30 loc) · 1.28 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
37
38
<% if (testType === 'integration') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>
describe('<%= friendlyTestDescription %>', function () {
setupRenderingTest();
it('renders', async function () {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<%= selfCloseComponent(componentName) %>`);
expect(this.element.textContent.trim()).to.equal('');
// Template block usage:
await render(hbs`
<%= openComponent(componentName) %>
template block text
<%= closeComponent(componentName) %>
`);
expect(this.element.textContent.trim()).to.equal('template block text');
});
});<% } else if (testType === 'unit') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from '<%= modulePrefix %>/tests/helpers';
describe('<%= friendlyTestDescription %>', function () {
setupTest();
it('exists', function () {
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
expect(component).to.be.ok;
});
});<% } %>