gecko/browser/devtools/debugger/test/browser_dbg_variables-view-04.js

151 lines
5.6 KiB
JavaScript
Raw Normal View History

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 06:23:18 -07:00
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that grips are correctly applied to variables.
*/
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");
let testVar = testScope.addItem("something");
testVar.setGrip(1.618);
is(testVar.target.querySelector(".value").getAttribute("value"), "1.618",
"The grip information for the variable wasn't set correctly (1).");
is(testVar.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"Setting the grip alone shouldn't add any new tree nodes (1).");
is(testVar.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"Setting the grip alone shouldn't add any new tree nodes (2).");
testVar.setGrip({
type: "object",
class: "Window"
});
is(testVar.target.querySelector(".value").getAttribute("value"), "Window",
"The grip information for the variable wasn't set correctly (2).");
is(testVar.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"Setting the grip alone shouldn't add any new tree nodes (3).");
is(testVar.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"Setting the grip alone shouldn't add any new tree nodes (4).");
testVar.addItems({
helloWorld: {
value: "hello world",
enumerable: true
}
});
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
"A new detail node should have been added in the variable tree.");
is(testVar.get("helloWorld").target.querySelector(".value").getAttribute("value"), "\"hello world\"",
"The grip information for the variable wasn't set correctly (3).");
testVar.addItems({
helloWorld: {
value: "hello jupiter",
enumerable: true
}
});
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
"Shouldn't be able to duplicate nodes added in the variable tree.");
is(testVar.get("helloWorld").target.querySelector(".value").getAttribute("value"), "\"hello world\"",
"The grip information for the variable wasn't preserved correctly (4).");
testVar.addItems({
someProp0: {
value: "random string",
enumerable: true
},
someProp1: {
value: "another string",
enumerable: true
}
});
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 3,
"Two new detail nodes should have been added in the variable tree.");
is(testVar.get("someProp0").target.querySelector(".value").getAttribute("value"), "\"random string\"",
"The grip information for the variable wasn't set correctly (5).");
is(testVar.get("someProp1").target.querySelector(".value").getAttribute("value"), "\"another string\"",
"The grip information for the variable wasn't set correctly (6).");
testVar.addItems({
someProp2: {
value: {
type: "null"
},
enumerable: true
},
someProp3: {
value: {
type: "undefined"
},
enumerable: true
},
someProp4: {
value: {
type: "object",
class: "Object"
},
enumerable: true
}
});
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 6,
"Three new detail nodes should have been added in the variable tree.");
is(testVar.get("someProp2").target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the variable wasn't set correctly (7).");
is(testVar.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the variable wasn't set correctly (8).");
is(testVar.get("someProp4").target.querySelector(".value").getAttribute("value"), "Object",
"The grip information for the variable wasn't set correctly (9).");
let parent = testVar.get("someProp2");
let child = parent.addItem("child", {
value: {
type: "null"
}
});
is(variables.getItemForNode(parent.target), parent,
"VariablesView should have a record of the parent.");
is(variables.getItemForNode(child.target), child,
"VariablesView should have a record of the child.");
is([...parent].length, 1,
"Parent should have one child.");
parent.remove();
is(variables.getItemForNode(parent.target), undefined,
"VariablesView should not have a record of the parent anymore.");
is(parent.target.parentNode, null,
"Parent element should not have a parent.")
is(variables.getItemForNode(child.target), undefined,
"VariablesView should not have a record of the child anymore.");
is(child.target.parentNode, null,
"Child element should not have a parent.")
is([...parent].length, 0,
"Parent should have zero children.");
testScope.remove();
is([...variables].length, 0,
"VariablesView should have been emptied.");
is(Cu.nondeterministicGetWeakMapKeys(variables._itemsByElement).length, 0,
"VariablesView _itemsByElement map has been emptied.");
is(variables._currHierarchy.size, 0,
"VariablesView _currHierarchy map has been emptied.");
is(variables._list.children.length, 0,
"VariablesView element should have no children.");
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 06:23:18 -07:00
closeDebuggerAndFinish(aPanel);
});
}