зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1109764 - Correctly toggle the details view buttons in the performance tool. r=vp
This commit is contained in:
Родитель
3f9f2ff3bd
Коммит
91615d22fc
|
@ -25,22 +25,20 @@ function spawnTest () {
|
|||
is(viewName, "waterfall", "DETAILS_VIEW_SELECTED fired with view name");
|
||||
checkViews(DetailsView, doc, "waterfall");
|
||||
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
||||
|
||||
function checkViews (DetailsView, doc, currentView) {
|
||||
for (let viewName in DetailsView.views) {
|
||||
let view = DetailsView.views[viewName].el;
|
||||
let button = doc.querySelector("toolbarbutton[data-view='" + viewName + "']");
|
||||
for (let viewName in DetailsView.viewIndexes) {
|
||||
let button = doc.querySelector(`toolbarbutton[data-view="${viewName}"]`);
|
||||
|
||||
is(DetailsView.el.selectedIndex, DetailsView.viewIndexes[currentView],
|
||||
`DetailsView correctly has ${currentView} selected.`);
|
||||
if (viewName === currentView) {
|
||||
ok(!view.getAttribute("hidden"), view + " view displayed");
|
||||
ok(button.getAttribute("checked"), view + " button checked");
|
||||
ok(button.getAttribute("checked"), `${viewName} button checked`);
|
||||
} else {
|
||||
ok(view.getAttribute("hidden"), view + " view hidden");
|
||||
ok(!button.getAttribute("checked"), view + " button not checked");
|
||||
ok(!button.getAttribute("checked"), `${viewName} button not checked`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,14 @@ let DetailsView = {
|
|||
*/
|
||||
selectView: function (selectedView) {
|
||||
this.el.selectedIndex = this.viewIndexes[selectedView];
|
||||
|
||||
for (let button of $$("toolbarbutton[data-view]", $("#details-toolbar"))) {
|
||||
if (button.getAttribute("data-view") === selectedView)
|
||||
button.setAttribute("checked", true);
|
||||
else
|
||||
button.removeAttribute("checked");
|
||||
}
|
||||
|
||||
this.emit(EVENTS.DETAILS_VIEW_SELECTED, selectedView);
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче