Bug 1433655 - Allow JSON Viewer to change expandedNodes state. draft
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Sun, 28 Jan 2018 22:50:16 +0100
changeset 748168 f4c2d54d3e431bed45c0ab2de2ea41980646b655
parent 723473 e2bb11b88bd45bdb2e055042e1624b74d414e73c
push id97079
push userbmo:oriol-bugzilla@hotmail.com
push dateSun, 28 Jan 2018 21:59:45 +0000
bugs1433655
milestone60.0a1
Bug 1433655 - Allow JSON Viewer to change expandedNodes state. MozReview-Commit-ID: C2Db2U2KQKp
devtools/client/jsonview/components/MainTabbedArea.js
devtools/client/jsonview/test/browser_jsonview_chunked_json.js
--- a/devtools/client/jsonview/components/MainTabbedArea.js
+++ b/devtools/client/jsonview/components/MainTabbedArea.js
@@ -60,17 +60,17 @@ define(function (require, exports, modul
         Tabs({
           tabActive: this.state.tabActive,
           onAfterChange: this.onTabChanged},
           TabPanel({
             className: "json",
             title: JSONView.Locale.$STR("jsonViewer.tab.JSON")},
             JsonPanel({
               data: this.state.json,
-              expandedNodes: this.props.expandedNodes,
+              expandedNodes: this.state.expandedNodes,
               actions: this.props.actions,
               searchFilter: this.state.searchFilter
             })
           ),
           TabPanel({
             className: "rawdata",
             title: JSONView.Locale.$STR("jsonViewer.tab.RawData")},
             TextPanel({
--- a/devtools/client/jsonview/test/browser_jsonview_chunked_json.js
+++ b/devtools/client/jsonview/test/browser_jsonview_chunked_json.js
@@ -36,29 +36,29 @@ add_task(async function () {
   ok(await getElementText(".headersPanelBox .netInfoHeadersTable"),
     "The headers table has been filled.");
 
   // Write some text without being in Raw Data, then switch tab and check.
   await write("2");
   await selectJsonViewContentTab("rawdata");
   await checkText();
 
-  // Another text check.
-  await write("]");
+  // Add an array, when counting rows we will ensure it has been expanded automatically.
+  await write(",[3]]");
   await checkText();
 
   // Close the connection.
   let appReady = waitForContentMessage("Test:JsonView:AppReadyStateChange");
   await server("close");
   await appReady;
 
   is(await getElementCount(".json.is-active"), 1, "The JSON tab is selected.");
 
-  is(await getElementCount(".jsonPanelBox .treeTable .treeRow"), 2,
-    "There is a tree with 2 rows.");
+  is(await getElementCount(".jsonPanelBox .treeTable .treeRow"), 4,
+    "There is a tree with 4 rows.");
 
   await selectJsonViewContentTab("rawdata");
   await checkText();
 
   is(await getElementCount("button.prettyprint"), 1, "There is a pretty print button.");
   await clickJsonNode("button.prettyprint");
   await checkText(JSON.stringify(JSON.parse(data), null, 2));
 });