Bug 1377094 - Add tooltips to NetMonitor column headers. r=Honza

This commit is contained in:
Michael Brennan 2017-07-01 09:30:00 +02:00
parent 60af8b28a9
commit 12d0700317
5 changed files with 45 additions and 11 deletions

View File

@ -115,7 +115,7 @@ const RequestListHeader = createClass({
id: `requests-list-${name}-button`,
className: `requests-list-header-button`,
"data-sorted": sorted,
title: sortedTitle,
title: sortedTitle ? `${label} (${sortedTitle})` : label,
onClick: () => sortBy(name),
},
name === "waterfall"

View File

@ -72,6 +72,7 @@ support-files =
[browser_net_charts-06.js]
[browser_net_charts-07.js]
[browser_net_clear.js]
[browser_net_column_headers_tooltips.js]
[browser_net_columns_last_column.js]
[browser_net_columns_pref.js]
[browser_net_columns_reset.js]

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Bug 1377094 - Test that all column headers have tooltips.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document } = monitor.panelWin;
let headers = document.querySelectorAll(".requests-list-header-button");
for (let header of headers) {
const buttonText = header.querySelector(".button-text").textContent;
const tooltip = header.getAttribute("title");
is(buttonText, tooltip,
"The " + header.id + " header has the button text in its 'title' attribute.");
}
yield teardown(monitor);
});

View File

@ -117,15 +117,19 @@ add_task(function* () {
if (header != target) {
ok(!header.hasAttribute("data-sorted"),
"The " + header.id + " header does not have a 'data-sorted' attribute.");
ok(!header.getAttribute("title"),
"The " + header.id + " header does not have a 'title' attribute.");
ok(!header.getAttribute("title").includes(L10N.getStr("networkMenu.sortedAsc")) &&
!header.getAttribute("title").includes(L10N.getStr("networkMenu.sortedDesc")),
"The " + header.id +
" header does not include any sorting in the 'title' attribute.");
} else {
is(header.getAttribute("data-sorted"), direction,
"The " + header.id + " header has a correct 'data-sorted' attribute.");
is(header.getAttribute("title"), direction == "ascending"
const sorted = direction == "ascending"
? L10N.getStr("networkMenu.sortedAsc")
: L10N.getStr("networkMenu.sortedDesc"),
"The " + header.id + " header has a correct 'title' attribute.");
: L10N.getStr("networkMenu.sortedDesc");
ok(header.getAttribute("title").includes(sorted),
"The " + header.id +
" header includes the used sorting in the 'title' attribute.");
}
}
}

View File

@ -208,15 +208,19 @@ add_task(function* () {
if (header != target) {
ok(!header.hasAttribute("data-sorted"),
"The " + header.id + " header does not have a 'data-sorted' attribute.");
ok(!header.getAttribute("title"),
"The " + header.id + " header does not have a 'title' attribute.");
ok(!header.getAttribute("title").includes(L10N.getStr("networkMenu.sortedAsc")) &&
!header.getAttribute("title").includes(L10N.getStr("networkMenu.sortedDesc")),
"The " + header.id +
" header does not include any sorting in the 'title' attribute.");
} else {
is(header.getAttribute("data-sorted"), direction,
"The " + header.id + " header has a correct 'data-sorted' attribute.");
is(header.getAttribute("title"), direction == "ascending"
const sorted = direction == "ascending"
? L10N.getStr("networkMenu.sortedAsc")
: L10N.getStr("networkMenu.sortedDesc"),
"The " + header.id + " header has a correct 'title' attribute.");
: L10N.getStr("networkMenu.sortedDesc");
ok(header.getAttribute("title").includes(sorted),
"The " + header.id +
" header includes the used sorting in the 'title' attribute.");
}
}
}