Bug 1315635 - Netmonitor Performance View: fixed name of enableFilterTypeOnly action r?Honza
MozReview-Commit-ID: 5ZsDSXseiOA
--- a/devtools/client/netmonitor/performance-statistics-view.js
+++ b/devtools/client/netmonitor/performance-statistics-view.js
@@ -139,17 +139,17 @@ PerformanceStatisticsView.prototype = {
data: data,
strings: strings,
totals: totals,
sorted: sorted
});
chart.on("click", (_, item) => {
// Reset FilterButtons and enable one filter exclusively
- this.store.dispatch(Actions.enableFilterOnly(item.label));
+ this.store.dispatch(Actions.enableFilterTypeOnly(item.label));
NetMonitorView.showNetworkInspectorView();
});
container.appendChild(chart.node);
},
/**
* Sanitizes the data source used for creating charts, to follow the
--- a/devtools/client/netmonitor/test/browser_net_statistics-03.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-03.js
@@ -25,14 +25,21 @@ add_task(function* () {
let onEvents = promise.all([
panel.once(EVENTS.PRIMED_CACHE_CHART_DISPLAYED),
panel.once(EVENTS.EMPTY_CACHE_CHART_DISPLAYED)
]);
NetMonitorView.toggleFrontendMode();
yield onEvents;
+ is(NetMonitorView.currentFrontendMode, "network-statistics-view",
+ "The frontend mode is switched to the statistics view.");
+
EventUtils.sendMouseEvent({ type: "click" }, $(".pie-chart-slice"));
+
+ is(NetMonitorView.currentFrontendMode, "network-inspector-view",
+ "The frontend mode is switched back to the inspector view.");
+
testFilterButtons(monitor, "html");
info("The correct filtering predicate is used when exiting perf. analysis mode.");
yield teardown(monitor);
});
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -377,27 +377,29 @@ function waitFor(subject, eventName) {
let deferred = promise.defer();
subject.once(eventName, deferred.resolve);
return deferred.promise;
}
/**
* Tests if a button for a filter of given type is the only one checked.
*
- * @param string aFilterType
+ * @param string filterType
* The type of the filter that should be the only one checked.
*/
-function testFilterButtons(aMonitor, aFilterType) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-filter-" + aFilterType + "-button");
- let buttons = doc.querySelectorAll(".requests-menu-footer-button");
+function testFilterButtons(monitor, filterType) {
+ let doc = monitor.panelWin.document;
+ let target = doc.querySelector("#requests-menu-filter-" + filterType + "-button");
+ ok(target, `Filter button '${filterType}' was found`);
+ let buttons = [...doc.querySelectorAll(".menu-filter-button")];
+ ok(buttons.length > 0, "More than zero filter buttons were found");
// Only target should be checked.
- let checkStatus = [...buttons].map(button => button == target ? 1 : 0);
- testFilterButtonsCustom(aMonitor, checkStatus);
+ let checkStatus = buttons.map(button => button == target ? 1 : 0);
+ testFilterButtonsCustom(monitor, checkStatus);
}
/**
* Tests if filter buttons have 'checked' attributes set correctly.
*
* @param array aIsChecked
* An array specifying if a button at given index should have a
* 'checked' attribute. For example, if the third item of the array