Skip to content

Commit 65a7d92

Browse files
committed
test(template-require-input-type): pin scope-shadowed input cases — const + block-param (Copilot review)
1 parent f41bdb8 commit 65a7d92

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/lib/rules/template-require-input-type.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ gjsRuleTester.run('template-require-input-type', rule, {
9494
code: `<template>${code}</template>`,
9595
options,
9696
})),
97+
// Scope-shadowed `input` — the template's `<input>` refers to the local
98+
// const binding (a component), not the native HTML element. The rule
99+
// skips it via `isNativeElement`'s scope check.
100+
`const input = 'foo';
101+
<template><input type="not-a-valid-type" /></template>`,
102+
`const input = 'foo';
103+
<template><input /></template>`,
104+
// Block-param shadowing — `<Foo as |input|>` binds `input` inside the
105+
// yield block. The inner `<input>` should resolve to the block-param,
106+
// not the native tag.
107+
`import Foo from 'whatever';
108+
<template><Foo as |input|><input type="not-a-valid-type" /></Foo></template>`,
97109
],
98110
invalid: [
99111
...gjsInvalid,

0 commit comments

Comments
 (0)