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 ts=2 sw=2 sts=2 et: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
8 function test() {
9 addTab(TEST_URI);
10 browser.addEventListener("load", function onLoad() {
11 browser.removeEventListener("load", onLoad, true);
12 openConsole(null, testInputExpansion);
13 }, true);
14 }
16 function testInputExpansion(hud) {
17 let input = hud.jsterm.inputNode;
19 input.focus();
21 is(input.getAttribute("multiline"), "true", "multiline is enabled");
23 let ordinaryHeight = input.clientHeight;
25 // Tests if the inputNode expands.
26 input.value = "hello\nworld\n";
27 let length = input.value.length;
28 input.selectionEnd = length;
29 input.selectionStart = length;
30 // Performs an "d". This will trigger/test for the input event that should
31 // change the height of the inputNode.
32 EventUtils.synthesizeKey("d", {});
33 ok(input.clientHeight > ordinaryHeight, "the input expanded");
35 // Test if the inputNode shrinks again.
36 input.value = "";
37 EventUtils.synthesizeKey("d", {});
38 is(input.clientHeight, ordinaryHeight, "the input's height is normal again");
40 input = length = null;
42 finishTest();
43 }