@@ -31,7 +31,24 @@ ruleTester.run('template-no-invalid-aria-attributes', rule, {
3131 '<template><CustomComponent @ariaRequired={{this.ariaRequired}} aria-errormessage="errorId" /></template>' ,
3232 '<template><button type="submit" aria-disabled={{this.isDisabled}}>Submit</button></template>' ,
3333 '<template><div role="textbox" aria-sort={{if this.hasCustomSort "other" "ascending"}}></div></template>' ,
34+ // Boolean-type attributes with allowundefined: true per aria-query — the
35+ // string "undefined" is spec-valid (WAI-ARIA 1.2 value tables for these
36+ // attrs list true/false/undefined). All 4 share the same code path.
3437 '<template><div role="combobox" aria-expanded="undefined"></div></template>' ,
38+ '<template><div aria-hidden="undefined"></div></template>' ,
39+ '<template><div aria-grabbed="undefined" draggable="true"></div></template>' ,
40+ '<template><div role="option" aria-selected="undefined"></div></template>' ,
41+
42+ // Token-type aria-orientation lists "undefined" in its values array;
43+ // passes the natural token check (no special-casing needed).
44+ '<template><div role="slider" aria-orientation="undefined"></div></template>' ,
45+ '<template><div role="slider" aria-orientation="horizontal"></div></template>' ,
46+
47+ // aria-pressed is tristate WITHOUT allowundefined — string "undefined"
48+ // is NOT accepted. Explicit valid values still work.
49+ '<template><button aria-pressed="true">Toggle</button></template>' ,
50+ '<template><button aria-pressed="false">Toggle</button></template>' ,
51+ '<template><button aria-pressed="mixed">Toggle</button></template>' ,
3552 '<template><button aria-label={{if @isNew (t "actions.add") (t "actions.edit")}}></button></template>' ,
3653 ] ,
3754 invalid : [
@@ -121,6 +138,18 @@ ruleTester.run('template-no-invalid-aria-attributes', rule, {
121138 output : null ,
122139 errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
123140 } ,
141+ {
142+ code : '<template><div role="slider" aria-orientation="sideways"></div></template>' ,
143+ output : null ,
144+ errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
145+ } ,
146+ // aria-pressed is tristate WITHOUT allowundefined — string "undefined"
147+ // is spec-invalid here (aria-query doesn't mark it allowundefined).
148+ {
149+ code : '<template><button aria-pressed="undefined">Toggle</button></template>' ,
150+ output : null ,
151+ errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
152+ } ,
124153 ] ,
125154} ) ;
126155
@@ -149,7 +178,21 @@ hbsRuleTester.run('template-no-invalid-aria-attributes', rule, {
149178 '<CustomComponent @ariaRequired={{this.ariaRequired}} aria-errormessage="errorId" />' ,
150179 '<button type="submit" aria-disabled={{this.isDisabled}}>Submit</button>' ,
151180 '<div role="textbox" aria-sort={{if this.hasCustomSort "other" "ascending"}}></div>' ,
181+ // Boolean-type attrs with allowundefined (spec-valid "undefined" literal):
152182 '<div role="combobox" aria-expanded="undefined"></div>' ,
183+ '<div aria-hidden="undefined"></div>' ,
184+ '<div aria-grabbed="undefined" draggable="true"></div>' ,
185+ '<div role="option" aria-selected="undefined"></div>' ,
186+
187+ // Token-type aria-orientation — "undefined" passes via values list:
188+ '<div role="slider" aria-orientation="undefined"></div>' ,
189+ '<div role="slider" aria-orientation="horizontal"></div>' ,
190+
191+ // aria-pressed is tristate WITHOUT allowundefined; valid values:
192+ '<button aria-pressed="true">Toggle</button>' ,
193+ '<button aria-pressed="false">Toggle</button>' ,
194+ '<button aria-pressed="mixed">Toggle</button>' ,
195+
153196 '<button aria-label={{if @isNew (t "actions.add") (t "actions.edit")}}></button>' ,
154197 ] ,
155198 invalid : [
@@ -223,5 +266,16 @@ hbsRuleTester.run('template-no-invalid-aria-attributes', rule, {
223266 output : null ,
224267 errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
225268 } ,
269+ {
270+ code : '<div role="slider" aria-orientation="sideways"></div>' ,
271+ output : null ,
272+ errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
273+ } ,
274+ // aria-pressed has no allowundefined — "undefined" is spec-invalid here.
275+ {
276+ code : '<button aria-pressed="undefined">Toggle</button>' ,
277+ output : null ,
278+ errors : [ { messageId : 'invalidAriaAttributeValue' } ] ,
279+ } ,
226280 ] ,
227281} ) ;
0 commit comments