mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 17:33:39 +08:00
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")
|
@discourseComputed("ariaExpanded")
|
||||||
computedAriaExpanded(ariaExpanded) {
|
computedAriaExpanded(ariaExpanded) {
|
||||||
return ariaExpanded ? "true" : "false";
|
if (ariaExpanded === true) {
|
||||||
|
return "true";
|
||||||
|
}
|
||||||
|
if (ariaExpanded === false) {
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
click(event) {
|
click(event) {
|
||||||
|
|
|
@ -206,10 +206,12 @@ discourseModule("Integration | Component | d-button", function (hooks) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("ariaExpanded", {
|
componentTest("aria-expanded", {
|
||||||
template: "{{d-button ariaExpanded=ariaExpanded}}",
|
template: hbs`{{d-button ariaExpanded=ariaExpanded}}`,
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
|
assert.equal(query("button").ariaExpanded, null);
|
||||||
|
|
||||||
this.set("ariaExpanded", true);
|
this.set("ariaExpanded", true);
|
||||||
|
|
||||||
assert.equal(query("button").ariaExpanded, "true");
|
assert.equal(query("button").ariaExpanded, "true");
|
||||||
|
@ -220,16 +222,16 @@ discourseModule("Integration | Component | d-button", function (hooks) {
|
||||||
|
|
||||||
this.set("ariaExpanded", "false");
|
this.set("ariaExpanded", "false");
|
||||||
|
|
||||||
assert.equal(query("button").ariaExpanded, "true");
|
assert.equal(query("button").ariaExpanded, null);
|
||||||
|
|
||||||
this.set("ariaExpanded", "true");
|
this.set("ariaExpanded", "true");
|
||||||
|
|
||||||
assert.equal(query("button").ariaExpanded, "true");
|
assert.equal(query("button").ariaExpanded, null);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("ariaControls", {
|
componentTest("aria-controls", {
|
||||||
template: "{{d-button ariaControls=ariaControls}}",
|
template: hbs`{{d-button ariaControls=ariaControls}}`,
|
||||||
|
|
||||||
test(assert) {
|
test(assert) {
|
||||||
this.set("ariaControls", "foo-bar");
|
this.set("ariaControls", "foo-bar");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user