зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135965 - JSON Response pane should contain both "Preview" and "Response Payload" views. r=ntim
This commit is contained in:
Родитель
70569f3a7a
Коммит
255bfa4d09
|
@ -156,17 +156,16 @@ const ResponsePanel = createClass({
|
|||
sectionName = JSON_SCOPE_NAME;
|
||||
}
|
||||
object[sectionName] = json;
|
||||
} else {
|
||||
sectionName = RESPONSE_PAYLOAD;
|
||||
|
||||
object[sectionName] = {
|
||||
EDITOR_CONFIG: {
|
||||
text,
|
||||
mode: mimeType.replace(/;.+/, ""),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Others like text/html, text/plain, application/javascript
|
||||
object[RESPONSE_PAYLOAD] = {
|
||||
EDITOR_CONFIG: {
|
||||
text,
|
||||
mode: json ? "application/json" : mimeType.replace(/;.+/, ""),
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
div({ className: "panel-container" },
|
||||
error && div({ className: "response-error-header", title: error },
|
||||
|
@ -175,7 +174,7 @@ const ResponsePanel = createClass({
|
|||
PropertiesView({
|
||||
object,
|
||||
filterPlaceHolder: JSON_FILTER_TEXT,
|
||||
sectionNames: [sectionName],
|
||||
sectionNames: Object.keys(object),
|
||||
}),
|
||||
)
|
||||
);
|
||||
|
|
|
@ -170,7 +170,7 @@ add_task(function* () {
|
|||
box != "json",
|
||||
"The response json view doesn't display");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null,
|
||||
box != "textarea",
|
||||
(box !== "textarea" && box !== "json"),
|
||||
"The response editor doesn't display");
|
||||
is(tabpanel.querySelector(".response-image-box") === null,
|
||||
box != "image",
|
||||
|
@ -208,8 +208,8 @@ add_task(function* () {
|
|||
case "json": {
|
||||
checkVisibility("json");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
"The empty notice should not be displayed in this tabpanel.");
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ add_task(function* () {
|
|||
});
|
||||
yield wait;
|
||||
|
||||
wait = waitForDOM(document, "#response-panel");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -37,13 +37,13 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 1,
|
||||
"There should be 1 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
|
|
@ -48,7 +48,7 @@ add_task(function* () {
|
|||
time: true
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -67,13 +67,13 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 2047,
|
||||
"There should be 2047 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
|
|
@ -62,7 +62,7 @@ add_task(function* () {
|
|||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), false,
|
||||
"The response json view doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ add_task(function* () {
|
|||
checkResponsePanelDisplaysJSON();
|
||||
|
||||
let tabpanel = document.querySelector("#response-panel");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 1,
|
||||
"There should be 1 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
@ -55,8 +55,8 @@ add_task(function* () {
|
|||
let jsonView = panel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(panel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(panel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(panel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ add_task(function* () {
|
|||
* Returns a promise that will resolve when the response panel DOM element is available.
|
||||
*/
|
||||
function openResponsePanel() {
|
||||
let onReponsePanelReady = waitForDOM(document, "#response-panel");
|
||||
let onReponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
|
|
@ -42,7 +42,7 @@ add_task(function* () {
|
|||
time: true
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -61,13 +61,13 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 1,
|
||||
"There should be 1 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
|
|
@ -43,7 +43,7 @@ add_task(function* () {
|
|||
time: true
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -62,13 +62,13 @@ add_task(function* () {
|
|||
let jsonView = tabpanel.querySelector(".tree-section .treeLabel") || {};
|
||||
is(jsonView.textContent === L10N.getStr("jsonScopeName"), true,
|
||||
"The response json view has the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".response-image-box") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 1,
|
||||
"There should be 1 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
|
|
@ -57,7 +57,8 @@ add_task(function* () {
|
|||
time: true
|
||||
});
|
||||
|
||||
wait = waitForDOM(document, "#response-panel");
|
||||
info("Testing first request");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
document.querySelector(".network-details-panel-toggle"));
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
|
@ -66,7 +67,9 @@ add_task(function* () {
|
|||
|
||||
testResponseTab("$_0123Fun", "Hello JSONP!");
|
||||
|
||||
wait = waitForDOM(document, "#response-panel .tree-section");
|
||||
info("Testing second request");
|
||||
wait = waitForDOM(document, "#response-panel .CodeMirror-code");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||
document.querySelectorAll(".request-list-item")[1]);
|
||||
yield wait;
|
||||
|
@ -83,13 +86,13 @@ add_task(function* () {
|
|||
is(tabpanel.querySelector(".tree-section .treeLabel").textContent,
|
||||
L10N.getFormatStr("jsonpScopeName", func),
|
||||
"The response json view has the intened visibility and correct title.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, true,
|
||||
"The response editor doesn't have the intended visibility.");
|
||||
is(tabpanel.querySelector(".CodeMirror-code") === null, false,
|
||||
"The response editor has the intended visibility.");
|
||||
is(tabpanel.querySelector(".responseImageBox") === null, true,
|
||||
"The response image box doesn't have the intended visibility.");
|
||||
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 1,
|
||||
"There should be 1 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".tree-section").length, 2,
|
||||
"There should be 2 tree sections displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".treeRow:not(.tree-section)").length, 1,
|
||||
"There should be 1 json properties displayed in this tabpanel.");
|
||||
is(tabpanel.querySelectorAll(".empty-notice").length, 0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче