browser/devtools/styleinspector/test/browser_ruleview_keybindings.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
     2 /* Any copyright is dedicated to the Public Domain.
     3  http://creativecommons.org/publicdomain/zero/1.0/ */
     5 "use strict";
     7 // Test that focus doesn't leave the style editor when adding a property
     8 // (bug 719916)
    10 let test = asyncTest(function*() {
    11   yield addTab("data:text/html,<h1>Some header text</h1>");
    12   let {toolbox, inspector, view} = yield openRuleView();
    14   info("Selecting the test node");
    15   yield selectNode("h1", inspector);
    17   info("Getting the ruleclose brace element");
    18   let brace = view.doc.querySelector(".ruleview-ruleclose");
    20   info("Clicking on the brace element to focus the new property field");
    21   let onFocus = once(brace.parentNode, "focus", true);
    22   brace.click();
    23   yield onFocus;
    25   info("Entering a property name");
    26   let editor = getCurrentInplaceEditor(view);
    27   editor.input.value = "color";
    29   info("Typing ENTER to focus the next field: property value");
    30   let onFocus = once(brace.parentNode, "focus", true);
    31   EventUtils.sendKey("return");
    32   yield onFocus;
    33   ok(true, "The value field was focused");
    35   info("Entering a property value");
    36   let editor = getCurrentInplaceEditor(view);
    37   editor.input.value = "green";
    39   info("Typing ENTER again should focus a new property name");
    40   let onFocus = once(brace.parentNode, "focus", true);
    41   EventUtils.sendKey("return");
    42   yield onFocus;
    43   ok(true, "The new property name field was focused");
    44   getCurrentInplaceEditor(view).input.blur();
    45 });
    47 function getCurrentInplaceEditor(view) {
    48   return inplaceEditor(view.doc.activeElement);
    49 }

mercurial