1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-edit-cancel.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Make sure that canceling a name change correctly unhides the separator and 1.9 + * value elements. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; 1.13 + 1.14 +function test() { 1.15 + Task.spawn(function*() { 1.16 + let [tab, debuggee, panel] = yield initDebugger(TAB_URL); 1.17 + let win = panel.panelWin; 1.18 + let vars = win.DebuggerView.Variables; 1.19 + 1.20 + win.DebuggerView.WatchExpressions.addExpression("this"); 1.21 + 1.22 + // Allow this generator function to yield first. 1.23 + executeSoon(() => debuggee.ermahgerd()); 1.24 + yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS); 1.25 + 1.26 + let exprScope = vars.getScopeAtIndex(0); 1.27 + let {target} = exprScope.get("this"); 1.28 + 1.29 + let name = target.querySelector(".title > .name"); 1.30 + let separator = target.querySelector(".separator"); 1.31 + let value = target.querySelector(".value"); 1.32 + 1.33 + is(separator.hidden, false, 1.34 + "The separator element should not be hidden."); 1.35 + is(value.hidden, false, 1.36 + "The value element should not be hidden."); 1.37 + 1.38 + for (let key of ["ESCAPE", "RETURN"]) { 1.39 + EventUtils.sendMouseEvent({ type: "dblclick" }, name, win); 1.40 + 1.41 + is(separator.hidden, true, 1.42 + "The separator element should be hidden."); 1.43 + is(value.hidden, true, 1.44 + "The value element should be hidden."); 1.45 + 1.46 + EventUtils.sendKey(key, win); 1.47 + 1.48 + is(separator.hidden, false, 1.49 + "The separator element should not be hidden."); 1.50 + is(value.hidden, false, 1.51 + "The value element should not be hidden."); 1.52 + } 1.53 + 1.54 + yield resumeDebuggerThenCloseAndFinish(panel); 1.55 + }); 1.56 +}