1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
6 let doc
, tbody
, tabAboutProcesses
;
8 const rowTypes
= ["process", "window", "thread-summary", "thread"];
10 function promiseUpdate() {
11 return promiseAboutProcessesUpdated({
19 add_setup(async
function () {
20 Services
.prefs
.setBoolPref("toolkit.aboutProcesses.showThreads", true);
22 info("Setting up about:processes");
23 tabAboutProcesses
= await BrowserTestUtils
.openNewForegroundTab({
25 opening
: "about:processes",
29 doc
= tabAboutProcesses
.linkedBrowser
.contentDocument
;
30 tbody
= doc
.getElementById("process-tbody");
31 await
promiseUpdate();
34 add_task(function testTwistyImageButtonSetup() {
35 let twistyBtn
= doc
.querySelector("tr.thread-summary .twisty");
36 let groupRow
= twistyBtn
.parentNode
.parentNode
;
37 let groupRowId
= groupRow
.firstChild
.children
[1].getAttribute("id");
38 let groupRowLabelId
= groupRowId
.split(":")[1];
40 info("Verify twisty button is properly set up.");
42 twistyBtn
.hasAttribute("aria-labelledby"),
43 "the Twisty image button has an aria-labelledby"
46 twistyBtn
.getAttribute("aria-labelledby"),
47 `${groupRowLabelId}-label ${groupRowId}`,
48 "the Twisty image button's aria-labelledby refers to a valid 'id' that is the Name of its row"
51 twistyBtn
.getAttribute("role"),
53 "the Twisty image is programmatically a button"
56 twistyBtn
.getAttribute("tabindex"),
58 "the Twisty image button is included in the focus order"
61 twistyBtn
.getAttribute("aria-expanded"),
63 "the Twisty image button is collapsed by default"
67 add_task(function testTwistyImageButtonClicking() {
68 let twistyBtn
= doc
.querySelector("tr.thread-summary .twisty");
69 let groupRow
= twistyBtn
.parentNode
.parentNode
;
72 "Verify we can toggle/open a list of threads by clicking the twisty button."
77 groupRow
.nextSibling
.classList
.contains("thread") &&
78 !groupRow
.nextSibling
.classList
.contains("thread-summary"),
79 "clicking a collapsed Twisty adds subitems after the row"
82 twistyBtn
.getAttribute("aria-expanded"),
84 "the Twisty image button is expanded after a click"
88 add_task(function testTwistyImageButtonKeypressing() {
89 let twistyBtn
= doc
.querySelector("tr.thread-summary .twisty");
90 let groupRow
= twistyBtn
.parentNode
.parentNode
;
93 `Verify we can toggle/close a list of threads by pressing Enter or
94 Space on the twisty button.`
96 // Verify the twisty button can be focused with a keyboard.
101 "the Twisty image button can be focused"
104 // Verify we can toggle subitems with a keyboard.
105 // Twisty is expanded
106 EventUtils
.synthesizeKey("KEY_Enter");
108 !groupRow
.nextSibling
.classList
.contains("thread") ||
109 groupRow
.nextSibling
.classList
.contains("thread-summary"),
110 "pressing Enter on expanded Twisty hides a list of threads after the row"
113 twistyBtn
.getAttribute("aria-expanded"),
115 "the Twisty image button is collapsed after an Enter keypress"
117 // Twisty is collapsed
118 EventUtils
.synthesizeKey(" ");
120 groupRow
.nextSibling
.classList
.contains("thread") &&
121 !groupRow
.nextSibling
.classList
.contains("thread-summary"),
122 "pressing Space on collapsed Twisty shows a list of threads after the row"
125 twistyBtn
.getAttribute("aria-expanded"),
127 "the Twisty image button is expanded after a Space keypress"
131 add_task(function cleanup() {
132 BrowserTestUtils
.removeTab(tabAboutProcesses
);
133 Services
.prefs
.clearUserPref("toolkit.aboutProcesses.showThreads");