Bug 1336937 - Add aria-pressed to the filter buttons in new console. r=jdescottes
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Mon, 06 Feb 2017 13:41:08 +0100
changeset 479911 56b0d9ecb97b83a94f8edef1a44f3b3926facd5d
parent 479910 b2d14d738d2c38bd56225340b4dad320fe50bc7d
child 479912 5ef27c9b65efd9457f65d014082c2383bbd4aad7
push id44393
push userVYV03354@nifty.ne.jp
push dateTue, 07 Feb 2017 13:53:48 +0000
reviewersjdescottes
bugs1336937
milestone54.0a1
Bug 1336937 - Add aria-pressed to the filter buttons in new console. r=jdescottes MozReview-Commit-ID: FEvuSd3RQ67
devtools/client/webconsole/new-console-output/components/filter-button.js
devtools/client/webconsole/new-console-output/test/components/filter-button.test.js
--- a/devtools/client/webconsole/new-console-output/components/filter-button.js
+++ b/devtools/client/webconsole/new-console-output/components/filter-button.js
@@ -32,15 +32,16 @@ const FilterButton = createClass({
       "menu-filter-button",
       filterKey,
     ];
     if (active) {
       classList.push("checked");
     }
 
     return dom.button({
+      "aria-pressed": active === true,
       className: classList.join(" "),
       onClick: this.onClick
     }, label);
   }
 });
 
 module.exports = FilterButton;
--- a/devtools/client/webconsole/new-console-output/test/components/filter-button.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/filter-button.test.js
@@ -15,20 +15,21 @@ describe("FilterButton component:", () =
     active: true,
     label: "Error",
     filterKey: MESSAGE_LEVEL.ERROR,
   };
 
   it("displays as active when turned on", () => {
     const wrapper = render(FilterButton(props));
     expect(wrapper.html()).toBe(
-      "<button class=\"menu-filter-button error checked\">Error</button>"
+      "<button aria-pressed=\"true\" class=\"menu-filter-button error checked\">" +
+      "Error</button>"
     );
   });
 
   it("displays as inactive when turned off", () => {
     const inactiveProps = Object.assign({}, props, { active: false });
     const wrapper = render(FilterButton(inactiveProps));
     expect(wrapper.html()).toBe(
-      "<button class=\"menu-filter-button error\">Error</button>"
+      "<button aria-pressed=\"false\" class=\"menu-filter-button error\">Error</button>"
     );
   });
 });