Skip to content

Commit 387bbf9

Browse files
committed
test: add missing coverage for no-accesskey-attribute and no-array-prototype-extensions
1 parent 326d36d commit 387bbf9

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

tests/lib/rules/template-no-accesskey-attribute.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,23 @@ ruleTester.run('template-no-accesskey-attribute', rule, {
5353
},
5454
],
5555
},
56+
// Boolean attribute (no value)
57+
{
58+
code: '<template><button accesskey></button></template>',
59+
output: '<template><button></button></template>',
60+
errors: [{ messageId: 'noAccesskey' }],
61+
},
62+
// Dynamic mustache value
63+
{
64+
code: '<template><button accesskey={{someKey}}></button></template>',
65+
output: '<template><button></button></template>',
66+
errors: [{ messageId: 'noAccesskey' }],
67+
},
68+
// Concat string attribute
69+
{
70+
code: '<template><button accesskey="{{someKey}}"></button></template>',
71+
output: '<template><button></button></template>',
72+
errors: [{ messageId: 'noAccesskey' }],
73+
},
5674
],
5775
});

tests/lib/rules/template-no-array-prototype-extensions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ ruleTester.run('template-no-array-prototype-extensions', rule, {
1717
// get helper with firstObject/lastObject as a direct top-level property (not an extension)
1818
"<template>{{get this 'firstObject'}}</template>",
1919
"<template>{{get this 'lastObject.name'}}</template>",
20+
// Plain text nodes are not flagged
21+
'<template>Just a regular text in the template bar.firstObject bar.lastObject.foo</template>',
22+
// String-literal HTML attributes are not flagged
23+
'<template><Foo foo="bar.firstObject.baz" /></template>',
2024
],
2125

2226
invalid: [
@@ -105,5 +109,11 @@ ruleTester.run('template-no-array-prototype-extensions', rule, {
105109
output: "<template><Foo @bar={{get @list '0.name'}} /></template>",
106110
errors: [{ messageId: 'firstObject' }],
107111
},
112+
// lastObject — in named hash argument
113+
{
114+
code: '<template>{{foo [email protected]}}</template>',
115+
output: null,
116+
errors: [{ messageId: 'lastObject' }],
117+
},
108118
],
109119
});

0 commit comments

Comments
 (0)