Commit a1f7ac50 authored by Oriol Brufau's avatar Oriol Brufau
Browse files

Bug 1328008 - Stop collapsing TreeView nodes when clicking a value. r=Honza

parent 8dfeaddc
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -14,20 +14,25 @@ add_task(function* () {

  ok(tab.linkedBrowser.contentPrincipal.isNullPrincipal, "Should have null principal");

  let countBefore = yield getElementCount(".jsonPanelBox .treeTable .treeRow");
  ok(countBefore == 3, "There must be three rows");
  is(yield countRows(), 3, "There must be three rows");

  let objectCellCount = yield getElementCount(
    ".jsonPanelBox .treeTable .objectCell");
  ok(objectCellCount == 1, "There must be one object cell");
  is(objectCellCount, 1, "There must be one object cell");

  let objectCellText = yield getElementText(
    ".jsonPanelBox .treeTable .objectCell");
  ok(objectCellText == "", "The summary is hidden when object is expanded");
  is(objectCellText, "", "The summary is hidden when object is expanded");

  // Collapsed auto-expanded node.
  yield clickJsonNode(".jsonPanelBox .treeTable .treeLabel");
  // Clicking the value does not collapse it (so that it can be selected and copied).
  yield clickJsonNode(".jsonPanelBox .treeTable .treeValueCell");
  is(yield countRows(), 3, "There must still be three rows");

  let countAfter = yield getElementCount(".jsonPanelBox .treeTable .treeRow");
  ok(countAfter == 1, "There must be one row");
  // Clicking the label collapses the auto-expanded node.
  yield clickJsonNode(".jsonPanelBox .treeTable .treeLabel");
  is(yield countRows(), 1, "There must be one row");
});

function countRows() {
  return getElementCount(".jsonPanelBox .treeTable .treeRow");
}
+4 −1
Original line number Diff line number Diff line
@@ -213,7 +213,10 @@ define(function (require, exports, module) {

    onClickRow: function (nodePath, event) {
      event.stopPropagation();
      let cell = event.target.closest("td");
      if (cell && cell.classList.contains("treeLabelCell")) {
        this.toggle(nodePath);
      }
      this.selectRow(nodePath);
    },