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

assert that a component tagName can not be a computed property #14750

Merged
merged 1 commit into from
Dec 23, 2016
Merged
Show file tree
Hide file tree
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
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's \`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's `tagName` \(<\(.+>\)\./);
}

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