Skip to content

Commit 7a8bb29

Browse files
committed
test: add coverage for doc-pagebreak and graphics-symbol additions
1 parent f07093f commit 7a8bb29

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

tests/lib/rules/template-require-presentational-children.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ ruleTester.run('template-require-presentational-children', rule, {
3535
<title>Title here</title>
3636
<circle cx="10" cy="10" r="10"></circle>
3737
</svg></template>`,
38+
// SKIPPED_TAGS: <svg> is always skipped, even when its role has childrenPresentational
39+
// (graphics-symbol is such a role via Graphics-ARIA; this covers the new aria-query-derived set).
40+
`<template>
41+
<svg role="graphics-symbol">
42+
<circle cx="10" cy="10" r="10"></circle>
43+
</svg></template>`,
3844
`<template>
3945
<MyButton role="tab">
4046
<:default>Button text</:default>
@@ -77,6 +83,28 @@ ruleTester.run('template-require-presentational-children', rule, {
7783
},
7884
],
7985
},
86+
// doc-pagebreak: DPUB-ARIA role with childrenPresentational; now included via aria-query.
87+
{
88+
code: '<template><div role="doc-pagebreak"><h2>pg</h2></div></template>',
89+
output: null,
90+
errors: [
91+
{
92+
message:
93+
'<div> has a role of doc-pagebreak, it cannot have semantic descendants like <h2>',
94+
},
95+
],
96+
},
97+
// graphics-symbol: Graphics-ARIA role with childrenPresentational; flags on non-svg host.
98+
{
99+
code: '<template><div role="graphics-symbol"><text>X</text></div></template>',
100+
output: null,
101+
errors: [
102+
{
103+
message:
104+
'<div> has a role of graphics-symbol, it cannot have semantic descendants like <text>',
105+
},
106+
],
107+
},
80108
],
81109
});
82110

@@ -109,6 +137,12 @@ hbsRuleTester.run('template-require-presentational-children', rule, {
109137
<title>Title here</title>
110138
<circle cx="10" cy="10" r="10"></circle>
111139
</svg>`,
140+
// SKIPPED_TAGS: <svg> is always skipped, even when its role has childrenPresentational
141+
// (graphics-symbol is such a role via Graphics-ARIA; this covers the new aria-query-derived set).
142+
`
143+
<svg role="graphics-symbol">
144+
<circle cx="10" cy="10" r="10"></circle>
145+
</svg>`,
112146
`
113147
<MyButton role="tab">
114148
<:default>Button text</:default>
@@ -150,5 +184,27 @@ hbsRuleTester.run('template-require-presentational-children', rule, {
150184
},
151185
],
152186
},
187+
// doc-pagebreak: DPUB-ARIA role with childrenPresentational; now included via aria-query.
188+
{
189+
code: '<div role="doc-pagebreak"><h2>pg</h2></div>',
190+
output: null,
191+
errors: [
192+
{
193+
message:
194+
'<div> has a role of doc-pagebreak, it cannot have semantic descendants like <h2>',
195+
},
196+
],
197+
},
198+
// graphics-symbol: Graphics-ARIA role with childrenPresentational; flags on non-svg host.
199+
{
200+
code: '<div role="graphics-symbol"><text>X</text></div>',
201+
output: null,
202+
errors: [
203+
{
204+
message:
205+
'<div> has a role of graphics-symbol, it cannot have semantic descendants like <text>',
206+
},
207+
],
208+
},
153209
],
154210
});

0 commit comments

Comments
 (0)