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

[BUGFIX beta] assert <Input> and <Textarea> #17733

Merged
merged 1 commit into from Mar 14, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/@ember/-internals/glimmer/lib/resolver.ts
Expand Up @@ -123,9 +123,6 @@ export default class RuntimeResolver implements IRuntimeResolver<OwnedTemplateMe
* Called while executing Append Op.PushDynamicComponentManager if string
*/
lookupComponentDefinition(name: string, meta: OwnedTemplateMeta): Option<ComponentDefinition> {
assert('You cannot use `textarea` as a component name.', name !== 'textarea');
assert('You cannot use `input` as a component name.', name !== 'input');

let handle = this.lookupComponentHandle(name, meta);
if (handle === null) {
assert(
Expand Down Expand Up @@ -306,6 +303,9 @@ export default class RuntimeResolver implements IRuntimeResolver<OwnedTemplateMe
_name: string,
meta: OwnedTemplateMeta
): Option<ComponentDefinition> {
assert('You cannot use `textarea` as a component name.', _name !== 'textarea');
assert('You cannot use `input` as a component name.', _name !== 'input');

let name = _name;
let namespace = undefined;
if (EMBER_MODULE_UNIFICATION) {
Expand Down
Expand Up @@ -80,6 +80,12 @@ class InputRenderingTest extends RenderingTestCase {
moduleFor(
'Helpers test: {{input}}',
class extends InputRenderingTest {
['@test should not allow angle bracket invocation']() {
expectAssertion(() => {
this.render('<Input />');
}, 'You cannot use `input` as a component name.');
}

['@test a single text field is inserted into the DOM']() {
this.render(`{{input type="text" value=value}}`, { value: 'hello' });

Expand Down
Expand Up @@ -66,6 +66,12 @@ applyMixins(
moduleFor(
'Helpers test: {{textarea}}',
class extends TextAreaRenderingTest {
['@test Should not allow angle bracket invocation']() {
expectAssertion(() => {
this.render('<Textarea />');
}, 'You cannot use `textarea` as a component name.');
}

['@test Should insert a textarea'](assert) {
this.render('{{textarea}}');

Expand Down