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