DEV: makes aria-expanded boolean check strict (#12008)
{{d-button ariaExpanded=xxx}} only accepts Boolean now.
This commit is contained in:
parent
821bb1e8cb
commit
898772787c
|
@ -96,7 +96,12 @@ export default Component.extend({
|
|||
|
||||
@discourseComputed("ariaExpanded")
|
||||
computedAriaExpanded(ariaExpanded) {
|
||||
return ariaExpanded ? "true" : "false";
|
||||
if (ariaExpanded === true) {
|
||||
return "true";
|
||||
}
|
||||
if (ariaExpanded === false) {
|
||||
return "false";
|
||||
}
|
||||
},
|
||||
|
||||
click(event) {
|
||||
|
|
|
@ -206,10 +206,12 @@ discourseModule("Integration | Component | d-button", function (hooks) {
|
|||
},
|
||||
});
|
||||
|
||||
componentTest("ariaExpanded", {
|
||||
template: "{{d-button ariaExpanded=ariaExpanded}}",
|
||||
componentTest("aria-expanded", {
|
||||
template: hbs`{{d-button ariaExpanded=ariaExpanded}}`,
|
||||
|
||||
test(assert) {
|
||||
assert.equal(query("button").ariaExpanded, null);
|
||||
|
||||
this.set("ariaExpanded", true);
|
||||
|
||||
assert.equal(query("button").ariaExpanded, "true");
|
||||
|
@ -220,16 +222,16 @@ discourseModule("Integration | Component | d-button", function (hooks) {
|
|||
|
||||
this.set("ariaExpanded", "false");
|
||||
|
||||
assert.equal(query("button").ariaExpanded, "true");
|
||||
assert.equal(query("button").ariaExpanded, null);
|
||||
|
||||
this.set("ariaExpanded", "true");
|
||||
|
||||
assert.equal(query("button").ariaExpanded, "true");
|
||||
assert.equal(query("button").ariaExpanded, null);
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("ariaControls", {
|
||||
template: "{{d-button ariaControls=ariaControls}}",
|
||||
componentTest("aria-controls", {
|
||||
template: hbs`{{d-button ariaControls=ariaControls}}`,
|
||||
|
||||
test(assert) {
|
||||
this.set("ariaControls", "foo-bar");
|
||||
|
|
Loading…
Reference in New Issue