Skip to content

Commit

Permalink
assert that a component tagName can not be a computed property
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinJoyce committed Dec 22, 2016
1 parent 746fb91 commit 0cc5b52
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ember-glimmer/lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ const Component = CoreView.extend(
}
}
)());

assert(`You cannot use a computed property for the component \`tagName\` (${this}).`, !(this.tagName && this.tagName.isDescriptor));
},

rerender() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ moduleFor('Components test: curly components', class extends RenderingTest {
this.assertComponentElement(this.firstChild, { tagName: 'foo-bar', content: 'hello' });
}

['@test tagName can not be a computed property'](assert) {
let FooBarComponent = Component.extend({
tagName: computed(function() {
return 'foo-bar';
})
});

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

expectAssertion(() => {
this.render('{{foo-bar}}');
}, /You cannot use a computed property for the component `tagName` \(<\(.+>\)\./);
}

['@test class is applied before didInsertElement'](assert) {
let componentClass;
let FooBarComponent = Component.extend({
Expand Down

0 comments on commit 0cc5b52

Please sign in to comment.