Skip to content

Commit

Permalink
[BUGFIX release] Avoid assertion when bound id provided to tagless …
Browse files Browse the repository at this point in the history
…component

Fixes emberjs#14369
  • Loading branch information
HeroicEric committed Sep 29, 2016
1 parent fb1bd7f commit b01d7b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ moduleFor('Components test: fragment components', class extends RenderingTest {
this.assertText('baz');
}

['@test does not throw an error if `tagName` is an empty string and `id` is bound property specified via template']() {
let template = `{{id}}`;
let FooBarComponent = Component.extend({
tagName: ''
});

this.registerComponent('foo-bar', { ComponentClass: FooBarComponent, template });

this.render(`{{#foo-bar id=fooBarId}}{{/foo-bar}}`, { fooBarId: 'baz' });

this.assertText('baz');
}

['@test throws an error if when $() is accessed on component where `tagName` is an empty string']() {
let template = `hit dem folks`;
let FooBarComponent = Component.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function buildComponentTemplate({ component, tagName, layout, out

assert('You cannot use `elementId` on a tag-less component: ' + component.toString(), (() => {
let { elementId } = component;
return tagName !== '' || attrs.id === elementId || (!elementId && elementId !== '');
return tagName !== '' || getValue(attrs.id) === elementId || (!elementId && elementId !== '');
})());

assert('You cannot use `attributeBindings` on a tag-less component: ' + component.toString(), (() => {
Expand Down

0 comments on commit b01d7b3

Please sign in to comment.