Bug 1336937 - Add aria-pressed to the filter buttons in new console. r=jdescottes draft
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Mon, 06 Feb 2017 13:41:08 +0100
changeset 479504 6b7b7dd941c5567ca233c38eb0f310d2995184c4
parent 479455 12c02bf624c48903b155428f7c8a419ba7a333a6
child 544698 5158366510b5a9edbd2596b8d54c837baf86a220
push id44269
push userchevobbe.nicolas@gmail.com
push dateMon, 06 Feb 2017 20:00:33 +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>"
     );
   });
 });