gecko/browser/devtools/debugger/test/browser_dbg_variables-view-01.js
Victor Porof c0c791431a 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

120 lines
4.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that creating, collpasing and expanding scopes 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");
ok(testScope,
"Should have created a scope.");
ok(testScope.id.contains("test"),
"The newly created scope should have the default id set.");
is(testScope.name, "test",
"The newly created scope should have the desired name set.");
ok(!testScope.displayValue,
"The newly created scope should not have a displayed value (1).");
ok(!testScope.displayValueClassName,
"The newly created scope should not have a displayed value (2).");
ok(testScope.target,
"The newly created scope should point to a target node.");
ok(testScope.target.id.contains("test"),
"Should have the correct scope id on the element.");
is(testScope.target.querySelector(".name").getAttribute("value"), "test",
"Any new scope should have the designated name.");
is(testScope.target.querySelector(".variables-view-element-details.enum").childNodes.length, 0,
"Any new scope should have a container with no enumerable child nodes.");
is(testScope.target.querySelector(".variables-view-element-details.nonenum").childNodes.length, 0,
"Any new scope should have a container with no non-enumerable child nodes.");
ok(!testScope.expanded,
"Any new created scope should be initially collapsed.");
ok(testScope.visible,
"Any new created scope should be initially visible.");
let expandCallbackArg = null;
let collapseCallbackArg = null;
let toggleCallbackArg = null;
let hideCallbackArg = null;
let showCallbackArg = null;
testScope.onexpand = aScope => expandCallbackArg = aScope;
testScope.oncollapse = aScope => collapseCallbackArg = aScope;
testScope.ontoggle = aScope => toggleCallbackArg = aScope;
testScope.onhide = aScope => hideCallbackArg = aScope;
testScope.onshow = aScope => showCallbackArg = aScope;
testScope.expand();
ok(testScope.expanded,
"The testScope shouldn't be collapsed anymore.");
is(expandCallbackArg, testScope,
"The expandCallback wasn't called as it should.");
testScope.collapse();
ok(!testScope.expanded,
"The testScope should be collapsed again.");
is(collapseCallbackArg, testScope,
"The collapseCallback wasn't called as it should.");
testScope.expanded = true;
ok(testScope.expanded,
"The testScope shouldn't be collapsed anymore.");
testScope.toggle();
ok(!testScope.expanded,
"The testScope should be collapsed again.");
is(toggleCallbackArg, testScope,
"The toggleCallback wasn't called as it should.");
testScope.hide();
ok(!testScope.visible,
"The testScope should be invisible after hiding.");
is(hideCallbackArg, testScope,
"The hideCallback wasn't called as it should.");
testScope.show();
ok(testScope.visible,
"The testScope should be visible again.");
is(showCallbackArg, testScope,
"The showCallback wasn't called as it should.");
testScope.visible = false;
ok(!testScope.visible,
"The testScope should be invisible after hiding.");
ok(!testScope.expanded,
"The testScope should remember it is collapsed even if it is hidden.");
testScope.visible = true;
ok(testScope.visible,
"The testScope should be visible after reshowing.");
ok(!testScope.expanded,
"The testScope should remember it is collapsed after it is reshown.");
EventUtils.sendMouseEvent({ type: "mousedown" },
testScope.target.querySelector(".title"),
aPanel.panelWin);
ok(testScope.expanded,
"Clicking the testScope tilte should expand it.");
EventUtils.sendMouseEvent({ type: "mousedown" },
testScope.target.querySelector(".title"),
aPanel.panelWin);
ok(!testScope.expanded,
"Clicking again the testScope tilte should collapse it.");
closeDebuggerAndFinish(aPanel);
});
}