Skip to content

Commit 177e7d0

Browse files
committed
Nice
1 parent b0fdc6f commit 177e7d0

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tests/lib/rules/template-builtin-component-arguments.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,53 @@ ruleTester.run('template-builtin-component-arguments', rule, {
4848
},
4949
],
5050
});
51+
52+
const hbsRuleTester = new RuleTester({
53+
parser: require.resolve('ember-eslint-parser/hbs'),
54+
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
55+
});
56+
57+
hbsRuleTester.run('template-builtin-component-arguments (hbs)', rule, {
58+
valid: [
59+
{ filename: 'layout.hbs', code: '<Input/>' },
60+
{ filename: 'layout.hbs', code: '<input type="text" size="10" />' },
61+
{ filename: 'layout.hbs', code: '<Input @type="text" size="10" />' },
62+
{ filename: 'layout.hbs', code: '<Input @type="checkbox" @checked={{true}} />' },
63+
{ filename: 'layout.hbs', code: '<Textarea @value="Tomster" />' },
64+
],
65+
invalid: [
66+
{
67+
filename: 'layout.hbs',
68+
code: '<Input type="text" size="10" />',
69+
output: null,
70+
errors: [
71+
{
72+
message:
73+
'Setting the `type` attribute on the builtin <Input> component is not allowed. Did you mean `@type`?',
74+
},
75+
],
76+
},
77+
{
78+
filename: 'layout.hbs',
79+
code: '<Input @type="checkbox" checked />',
80+
output: null,
81+
errors: [
82+
{
83+
message:
84+
'Setting the `checked` attribute on the builtin <Input> component is not allowed. Did you mean `@checked`?',
85+
},
86+
],
87+
},
88+
{
89+
filename: 'layout.hbs',
90+
code: '<Textarea value="Tomster" />',
91+
output: null,
92+
errors: [
93+
{
94+
message:
95+
'Setting the `value` attribute on the builtin <Textarea> component is not allowed. Did you mean `@value`?',
96+
},
97+
],
98+
},
99+
],
100+
});

0 commit comments

Comments
 (0)