Bug 1157916 - Add tooltip for displaying start/end times on marker details' duration field. r=vp

This commit is contained in:
Jordan Santell 2015-05-19 13:15:37 -07:00
parent 53e262d3fc
commit 307a087c72
2 changed files with 10 additions and 2 deletions

View File

@ -42,12 +42,17 @@ function spawnTest () {
is($("#waterfall-details .marker-details-type").getAttribute("value"), getMarkerLabel(m),
"sidebar title matches markers name");
let tooltip = $(".marker-details-duration").getAttribute("tooltiptext");
let printedDuration = $(".marker-details-duration .marker-details-labelvalue").getAttribute("value");
let toMs = ms => L10N.getFormatStrWithNumbers("timeline.tick", ms);
// Values are rounded. We don't use a strict equality.
is(toMs(m.end - m.start), printedDuration, "sidebar duration is valid");
// For some reason, anything that creates "→" here turns it into a "â" for some reason.
// So just check that start and end time are in there somewhere.
ok(tooltip.indexOf(toMs(m.start)) !== -1, "tooltip has start time");
ok(tooltip.indexOf(toMs(m.end)) !== -1, "tooltip has end time");
}
yield teardown(panel);
finish();

View File

@ -138,9 +138,12 @@ const DOM = exports.DOM = {
*/
buildDuration: function (doc, marker) {
let label = L10N.getStr("timeline.markerDetail.duration");
let value = L10N.getFormatStrWithNumbers("timeline.tick", marker.end - marker.start);
let el = DOM.buildNameValueLabel(doc, label, value);
let start = L10N.getFormatStrWithNumbers("timeline.tick", marker.start);
let end = L10N.getFormatStrWithNumbers("timeline.tick", marker.end);
let duration = L10N.getFormatStrWithNumbers("timeline.tick", marker.end - marker.start);
let el = DOM.buildNameValueLabel(doc, label, duration);
el.classList.add("marker-details-duration");
el.setAttribute("tooltiptext", `${start}${end}`);
return el;
},