Bug 1433655 - Allow JSON Viewer to change expandedNodes state. r=Honza a=RyanVM
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Sun, 28 Jan 2018 22:50:16 +0100
changeset 454701 cd07ba84f98d8368e334b4e8fe4375350c0121e0
parent 454700 367b18b6007bd65b84cc77e027e9bbcc20e55350
child 454702 2d975e7d80673f2f86212273e11274040db2b3cc
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza, RyanVM
bugs1433655
milestone59.0
Bug 1433655 - Allow JSON Viewer to change expandedNodes state. r=Honza a=RyanVM 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));
 });