Bug 879185 - Netmonitor filterbuttons: button.setAttribute("checked", ""); --> Should be set to "true", r=rcampbell

This commit is contained in:
Victor Porof 2013-06-21 17:33:57 +03:00
parent f978c469c9
commit 44a76e4261
5 changed files with 16 additions and 15 deletions

View File

@ -361,10 +361,10 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
* Filters all network requests in this container by a specified type.
*
* @param string aType
* Either null, "html", "css", "js", "xhr", "fonts", "images", "media"
* Either "all", "html", "css", "js", "xhr", "fonts", "images", "media"
* or "flash".
*/
filterOn: function(aType) {
filterOn: function(aType = "all") {
let target = $("#requests-menu-filter-" + aType + "-button");
let buttons = document.querySelectorAll(".requests-menu-footer-button");
@ -372,16 +372,15 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
if (button != target) {
button.removeAttribute("checked");
} else {
button.setAttribute("checked", "");
button.setAttribute("checked", "true");
}
}
// Filter on nothing.
if (!target) {
this.filterContents(() => true);
}
// Filter on whatever was requested.
else switch (aType) {
switch (aType) {
case "all":
this.filterContents(() => true);
break;
case "html":
this.filterContents(this._onHtml);
break;
@ -415,7 +414,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
* Sorts all network requests in this container by a specified detail.
*
* @param string aType
* Either "status", "method", "file", "domain", "type", "size" or "waterfall".
* Either "status", "method", "file", "domain", "type", "size" or
* "waterfall".
*/
sortBy: function(aType = "waterfall") {
let target = $("#requests-menu-" + aType + "-button");

View File

@ -138,7 +138,8 @@
flex="100"/>
<button id="requests-menu-filter-all-button"
class="requests-menu-footer-button"
onclick="NetMonitorView.RequestsMenu.filterOn(null)"
checked="true"
onclick="NetMonitorView.RequestsMenu.filterOn('all')"
label="&netmonitorUI.footer.filterAll;">
</button>
<button id="requests-menu-filter-html-button"

View File

@ -24,7 +24,7 @@ function test() {
is(NetMonitorView.detailsPaneHidden, false,
"The details pane should not be hidden after toggle button was pressed.");
testButtons();
testButtons("all");
testContents([1, 1, 1, 1, 1, 1, 1, 1])
.then(() => {
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
@ -68,7 +68,7 @@ function test() {
})
.then(() => {
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-all-button"));
testButtons();
testButtons("all");
return testContents([1, 1, 1, 1, 1, 1, 1, 1]);
})
.then(() => {

View File

@ -24,7 +24,7 @@ function test() {
is(NetMonitorView.detailsPaneHidden, false,
"The details pane should not be hidden after toggle button was pressed.");
testButtons();
testButtons("all");
testContents([1, 1, 1, 1, 1, 1, 1, 1])
.then(() => {
info("Testing html filtering.");

View File

@ -25,12 +25,12 @@ function test() {
is(NetMonitorView.detailsPaneHidden, false,
"The details pane should not be hidden after toggle button was pressed.");
testButtons();
testButtons("all");
testContents([0, 1, 2, 3, 4, 5, 6], 7, 0)
.then(() => {
info("Sorting by size, ascending.");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
testButtons();
testButtons("all");
return testContents([6, 4, 5, 0, 1, 2, 3], 7, 6);
})
.then(() => {