browser/devtools/debugger/test/browser_dbg_variables-view-edit-cancel.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Make sure that canceling a name change correctly unhides the separator and
michael@0 6 * value elements.
michael@0 7 */
michael@0 8
michael@0 9 const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html";
michael@0 10
michael@0 11 function test() {
michael@0 12 Task.spawn(function*() {
michael@0 13 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
michael@0 14 let win = panel.panelWin;
michael@0 15 let vars = win.DebuggerView.Variables;
michael@0 16
michael@0 17 win.DebuggerView.WatchExpressions.addExpression("this");
michael@0 18
michael@0 19 // Allow this generator function to yield first.
michael@0 20 executeSoon(() => debuggee.ermahgerd());
michael@0 21 yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
michael@0 22
michael@0 23 let exprScope = vars.getScopeAtIndex(0);
michael@0 24 let {target} = exprScope.get("this");
michael@0 25
michael@0 26 let name = target.querySelector(".title > .name");
michael@0 27 let separator = target.querySelector(".separator");
michael@0 28 let value = target.querySelector(".value");
michael@0 29
michael@0 30 is(separator.hidden, false,
michael@0 31 "The separator element should not be hidden.");
michael@0 32 is(value.hidden, false,
michael@0 33 "The value element should not be hidden.");
michael@0 34
michael@0 35 for (let key of ["ESCAPE", "RETURN"]) {
michael@0 36 EventUtils.sendMouseEvent({ type: "dblclick" }, name, win);
michael@0 37
michael@0 38 is(separator.hidden, true,
michael@0 39 "The separator element should be hidden.");
michael@0 40 is(value.hidden, true,
michael@0 41 "The value element should be hidden.");
michael@0 42
michael@0 43 EventUtils.sendKey(key, win);
michael@0 44
michael@0 45 is(separator.hidden, false,
michael@0 46 "The separator element should not be hidden.");
michael@0 47 is(value.hidden, false,
michael@0 48 "The value element should not be hidden.");
michael@0 49 }
michael@0 50
michael@0 51 yield resumeDebuggerThenCloseAndFinish(panel);
michael@0 52 });
michael@0 53 }

mercurial