Skip to content

Commit d102db6

Browse files
author
Robert Jackson
committed
Add tests for using render in beforeEach.
1 parent 398977a commit d102db6

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

__testfixtures__/ember-qunit-codemod/module-for-component.input.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,27 @@ test('it happens', function() {
4646

4747
test('it happens over and over', function() {
4848
});
49+
50+
moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
51+
integration: true,
52+
53+
beforeEach() {
54+
this.render(hbs`derp`);
55+
},
56+
});
57+
58+
test('can make assertion', function (assert) {
59+
assert.equal(this._element.textContent, 'derp');
60+
});
61+
62+
moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
63+
integration: true,
64+
65+
foo() {
66+
this.render(hbs`derp`);
67+
},
68+
});
69+
70+
test('can use render in custom method', function (assert) {
71+
assert.equal(this._element.textContent, 'derp');
72+
});

__testfixtures__/ember-qunit-codemod/module-for-component.output.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,29 @@ module('Unit | Component | FooBar', function(hooks) {
4747
test('it happens over and over', function() {
4848
});
4949
});
50+
51+
module('Integration | Component | FooBar', function(hooks) {
52+
setupRenderingTest(hooks);
53+
54+
hooks.beforeEach(async function() {
55+
await render(hbs`derp`);
56+
});
57+
58+
test('can make assertion', function (assert) {
59+
assert.equal(this.element.textContent, 'derp');
60+
});
61+
});
62+
63+
module('Integration | Component | FooBar', function(hooks) {
64+
setupRenderingTest(hooks);
65+
66+
hooks.beforeEach(function() {
67+
this.foo = async function() {
68+
await render(hbs`derp`);
69+
};
70+
});
71+
72+
test('can use render in custom method', function (assert) {
73+
assert.equal(this.element.textContent, 'derp');
74+
});
75+
});

0 commit comments

Comments
 (0)