Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTS: added block param w/ nested component + each-in example #16

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/integration/components/angle-bracket-invocation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,37 @@ module('Integration | Component | angle-bracket-invocation', function(hooks) {
assert.dom().hasText('hi rwjblue!');
});

test('yielding block param to nested child component using each-in', async function(assert) {
class ParentClazz extends Component {
get restaurants() {
return {
1: {
name: 'one',
},
2: {
name: 'two',
},
};
}
get layout() {
return hbs`{{yield restaurants}}`;
}
}

this.owner.register('component:the-parent', ParentClazz);
this.owner.register(
'template:components/the-child',
hbs`{{#each-in this.restaurants as |key item|}}<h1>{{item.name}}</h1>{{/each-in}}`
);

await render(
hbs`<TheParent as |restaurants|><TheChild @restaurants={{restaurants}} /></TheParent>`
);

assert.dom('h1:nth-of-type(1)').hasText('one');
assert.dom('h1:nth-of-type(2)').hasText('two');
});

test('with arguments', async function(assert) {
this.owner.register('template:components/foo-bar', hbs`<h2>{{title}}</h2>`);

Expand Down