Skip to content

Commit 3a42462

Browse files
authored
Merge pull request #56 from rwjblue/on-support
Process `this.on` statements.
2 parents d86f86f + 07f3ba9 commit 3a42462

File tree

3 files changed

+274
-99
lines changed

3 files changed

+274
-99
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { moduleForComponent, test } from 'ember-qunit';
2+
import hbs from 'htmlbars-inline-precompile';
3+
4+
moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
5+
integration: true
6+
});
7+
8+
test('it happens', function(assert) {
9+
assert.expect(1);
10+
11+
this.on('test', () => assert.ok(true));
12+
this.render(hbs`{{test-component test="test"}}`);
13+
});
14+
15+
test('it happens non-dotable identifier e.g. [test-foo]', function(assert) {
16+
assert.expect(1);
17+
18+
this.on('test-foo', () => assert.ok(true));
19+
this.render(hbs`{{test-component test="test"}}`);
20+
});
21+
22+
moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
23+
integration: true,
24+
beforeEach(assert) {
25+
this.on('test', () => assert.ok(true));
26+
}
27+
});
28+
29+
test('it happens', function(assert) {
30+
assert.expect(1);
31+
32+
this.render(hbs`{{test-component test="test"}}`);
33+
});
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
3+
import { render } from 'ember-test-helpers';
4+
import hbs from 'htmlbars-inline-precompile';
5+
6+
module('Integration | Component | FooBar', function(hooks) {
7+
setupRenderingTest(hooks);
8+
9+
hooks.beforeEach(function() {
10+
this.actions = {};
11+
this.send = (actionName, ...args) => this.actions[actionName].apply(this, args);
12+
});
13+
14+
test('it happens', async function(assert) {
15+
assert.expect(1);
16+
17+
this.actions.test = () => assert.ok(true);
18+
await render(hbs`{{test-component test="test"}}`);
19+
});
20+
21+
test('it happens non-dotable identifier e.g. [test-foo]', async function(assert) {
22+
assert.expect(1);
23+
24+
this.actions['test-foo'] = () => assert.ok(true);
25+
await render(hbs`{{test-component test="test"}}`);
26+
});
27+
});
28+
29+
module('Integration | Component | FooBar', function(hooks) {
30+
setupRenderingTest(hooks);
31+
32+
hooks.beforeEach(function() {
33+
this.actions = {};
34+
this.send = (actionName, ...args) => this.actions[actionName].apply(this, args);
35+
});
36+
37+
hooks.beforeEach(function(assert) {
38+
this.actions.test = () => assert.ok(true);
39+
});
40+
41+
test('it happens', async function(assert) {
42+
assert.expect(1);
43+
44+
await render(hbs`{{test-component test="test"}}`);
45+
});
46+
});

0 commit comments

Comments
 (0)