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

Failing test for {{yield}} inside a component that uses the element helper #1

Closed
wants to merge 1 commit into from
Closed
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
24 changes: 24 additions & 0 deletions tests/integration/helpers/element-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { render, settled } from '@ember/test-helpers';
import { helper } from '@ember/component/helper';
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import Component from '@ember/component';

module('Integration | Helper | element', function(hooks) {
let originalOnerror;
Expand Down Expand Up @@ -196,4 +197,27 @@ module('Integration | Helper | element', function(hooks) {
assert.dom('h2#content').doesNotExist();
assert.dom('h3#content').doesNotExist();
});

test('it can contain yielded content', async function (assert) {
this.owner.register("component:x-wrapper", Component.extend({
layout: hbs`
{{#let (element 'aside') as |Tag|}}
<Tag class="foo" ...attributes>{{yield}}</Tag>
<h3>Inside the let</h3>
{{/let}}
`
}));
// If you remove the splattributes on <Tag> it works :/

await render(hbs`
{{#x-wrapper}}
<h1>Inside the yield</h1>
{{/x-wrapper}}
<h2>External</h2>
`);
assert.dom('h2').hasText('External');
assert.dom('h3').hasText('Inside the let');
assert.dom('h1').hasText('Inside the yield');
assert.dom('aside').hasClass('foo');
});
});