gecko/browser/devtools/debugger/test/browser_dbg_variables-view-03.js
Victor Porof 4bc45f79e8 Bug 876277 - Cleanup debugger variables view tests, r=past
--HG--
rename : browser/devtools/debugger/test/browser_dbg_propertyview-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-02.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-04.js => browser/devtools/debugger/test/browser_dbg_variables-view-03.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-04.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-05.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-data.js => browser/devtools/debugger/test/browser_dbg_variables-view-data.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-02.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-value.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-watch.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-04.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-pref.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-07.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-02.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-09.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-03.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-10.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-with.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-12.js => browser/devtools/debugger/test/browser_dbg_variables-view-frozen-sealed-nonext.js
rename : browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js => browser/devtools/debugger/test/browser_dbg_variables-view-hide-non-enums.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js => browser/devtools/debugger/test/browser_dbg_variables-view-large-array-buffer.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js => browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-11.js => browser/devtools/debugger/test/browser_dbg_variables-view-webidl.js
2013-09-13 16:23:18 +03:00

152 lines
7.7 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that recursively creating properties in the variables view works
* as expected.
*/
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
let variables = aPanel.panelWin.DebuggerView.Variables;
let testScope = variables.addScope("test");
is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 1,
"One enumerable container should be present in the scope.");
is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1,
"One non-enumerable container should be present in the scope.");
is(testScope.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"No enumerable variables should be present in the scope.");
is(testScope.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No non-enumerable variables should be present in the scope.");
testScope.addItem("something", {
value: {
type: "object",
class: "Object"
},
enumerable: true
});
is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 2,
"Two enumerable containers should be present in the tree.");
is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 2,
"Two non-enumerable containers should be present in the tree.");
is(testScope.target.querySelector(".variables-view-element-details.enum").childNodes.length, 1,
"A new enumerable variable should have been added in the scope.");
is(testScope.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No new non-enumerable variables should have been added in the scope.");
let testVar = testScope.get("something");
ok(testVar,
"The added variable should be accessible from the scope.");
is(testVar.target.querySelectorAll(".variables-view-element-details.enum").length, 1,
"One enumerable container should be present in the variable.");
is(testVar.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1,
"One non-enumerable container should be present in the variable.");
is(testVar.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"No enumerable properties should be present in the variable.");
is(testVar.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No non-enumerable properties should be present in the variable.");
testVar.addItem("child", {
value: {
type: "object",
class: "Object"
},
enumerable: true
});
is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 3,
"Three enumerable containers should be present in the tree.");
is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 3,
"Three non-enumerable containers should be present in the tree.");
is(testVar.target.querySelector(".variables-view-element-details.enum").childNodes.length, 1,
"A new enumerable property should have been added in the variable.");
is(testVar.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No new non-enumerable properties should have been added in the variable.");
let testChild = testVar.get("child");
ok(testChild,
"The added property should be accessible from the variable.");
is(testChild.target.querySelectorAll(".variables-view-element-details.enum").length, 1,
"One enumerable container should be present in the property.");
is(testChild.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1,
"One non-enumerable container should be present in the property.");
is(testChild.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"No enumerable sub-properties should be present in the property.");
is(testChild.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No non-enumerable sub-properties should be present in the property.");
testChild.addItem("grandChild", {
value: {
type: "object",
class: "Object"
},
enumerable: true
});
is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 4,
"Four enumerable containers should be present in the tree.");
is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 4,
"Four non-enumerable containers should be present in the tree.");
is(testChild.target.querySelector(".variables-view-element-details.enum").childNodes.length, 1,
"A new enumerable sub-property should have been added in the property.");
is(testChild.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No new non-enumerable sub-properties should have been added in the property.");
let testGrandChild = testChild.get("grandChild");
ok(testGrandChild,
"The added sub-property should be accessible from the property.");
is(testGrandChild.target.querySelectorAll(".variables-view-element-details.enum").length, 1,
"One enumerable container should be present in the property.");
is(testGrandChild.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1,
"One non-enumerable container should be present in the property.");
is(testGrandChild.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"No enumerable sub-properties should be present in the property.");
is(testGrandChild.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No non-enumerable sub-properties should be present in the property.");
testGrandChild.addItem("granderChild", {
value: {
type: "object",
class: "Object"
},
enumerable: true
});
is(testScope.target.querySelectorAll(".variables-view-element-details.enum").length, 5,
"Five enumerable containers should be present in the tree.");
is(testScope.target.querySelectorAll(".variables-view-element-details.nonenum").length, 5,
"Five non-enumerable containers should be present in the tree.");
is(testGrandChild.target.querySelector(".variables-view-element-details.enum").childNodes.length, 1,
"A new enumerable variable should have been added in the variable.");
is(testGrandChild.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No new non-enumerable variables should have been added in the variable.");
let testGranderChild = testGrandChild.get("granderChild");
ok(testGranderChild,
"The added sub-property should be accessible from the property.");
is(testGranderChild.target.querySelectorAll(".variables-view-element-details.enum").length, 1,
"One enumerable container should be present in the property.");
is(testGranderChild.target.querySelectorAll(".variables-view-element-details.nonenum").length, 1,
"One non-enumerable container should be present in the property.");
is(testGranderChild.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"No enumerable sub-properties should be present in the property.");
is(testGranderChild.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"No non-enumerable sub-properties should be present in the property.");
closeDebuggerAndFinish(aPanel);
});
}