michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"; michael@0: michael@0: function test() { michael@0: addTab(TEST_URI); michael@0: browser.addEventListener("load", function onLoad() { michael@0: browser.removeEventListener("load", onLoad, true); michael@0: openConsole(null, testInputExpansion); michael@0: }, true); michael@0: } michael@0: michael@0: function testInputExpansion(hud) { michael@0: let input = hud.jsterm.inputNode; michael@0: michael@0: input.focus(); michael@0: michael@0: is(input.getAttribute("multiline"), "true", "multiline is enabled"); michael@0: michael@0: let ordinaryHeight = input.clientHeight; michael@0: michael@0: // Tests if the inputNode expands. michael@0: input.value = "hello\nworld\n"; michael@0: let length = input.value.length; michael@0: input.selectionEnd = length; michael@0: input.selectionStart = length; michael@0: // Performs an "d". This will trigger/test for the input event that should michael@0: // change the height of the inputNode. michael@0: EventUtils.synthesizeKey("d", {}); michael@0: ok(input.clientHeight > ordinaryHeight, "the input expanded"); michael@0: michael@0: // Test if the inputNode shrinks again. michael@0: input.value = ""; michael@0: EventUtils.synthesizeKey("d", {}); michael@0: is(input.clientHeight, ordinaryHeight, "the input's height is normal again"); michael@0: michael@0: input = length = null; michael@0: michael@0: finishTest(); michael@0: } michael@0: