Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 }