browser/devtools/debugger/test/browser_dbg_variables-view-edit-click.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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Check that the editing state of a Variable is correctly tracked. Clicking on
     6  * the textbox while editing should not cancel editing.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html";
    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;
    17     win.DebuggerView.WatchExpressions.addExpression("this");
    19     // Allow this generator function to yield first.
    20     executeSoon(() => debuggee.ermahgerd());
    21     yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS);
    23     let exprScope = vars.getScopeAtIndex(0);
    24     let exprVar = exprScope.get("this");
    25     let name = exprVar.target.querySelector(".title > .name");
    27     is(exprVar.editing, false,
    28       "The expression should indicate it is not being edited.");
    30     EventUtils.sendMouseEvent({ type: "dblclick" }, name, win);
    31     let input = exprVar.target.querySelector(".title > .element-name-input");
    32     is(exprVar.editing, true,
    33       "The expression should indicate it is being edited.");
    34     is(input.selectionStart !== input.selectionEnd, true,
    35       "The expression text should be selected.");
    37     EventUtils.synthesizeMouse(input, 2, 2, {}, win);
    38     is(exprVar.editing, true,
    39       "The expression should indicate it is still being edited after a click.");
    40     is(input.selectionStart === input.selectionEnd, true,
    41       "The expression text should not be selected.");
    43     EventUtils.sendKey("ESCAPE", win);
    44     is(exprVar.editing, false,
    45       "The expression should indicate it is not being edited after cancelling.");
    47     // Why is this needed?
    48     EventUtils.synthesizeMouse(vars.parentNode, 2, 2, {}, win);
    50     yield resumeDebuggerThenCloseAndFinish(panel);
    51   });
    52 }

mercurial