Bug 1433655 - Allow JSON Viewer to change expandedNodes state.
MozReview-Commit-ID: C2Db2U2KQKp
--- 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));
});