browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.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

michael@0 1 /* vim:set ts=2 sw=2 sts=2 et: */
michael@0 2 /*
michael@0 3 * Any copyright is dedicated to the Public Domain.
michael@0 4 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 5 *
michael@0 6 * Contributor(s):
michael@0 7 * Mihai Șucan <mihai.sucan@gmail.com>
michael@0 8 */
michael@0 9
michael@0 10 function consoleOpened(hud) {
michael@0 11 hud.jsterm.clearOutput();
michael@0 12
michael@0 13 let scrollNode = hud.outputNode.parentNode;
michael@0 14
michael@0 15 for (let i = 0; i < 150; i++) {
michael@0 16 content.console.log("test message " + i);
michael@0 17 }
michael@0 18
michael@0 19 let oldScrollTop = -1;
michael@0 20
michael@0 21 waitForMessages({
michael@0 22 webconsole: hud,
michael@0 23 messages: [{
michael@0 24 text: "test message 149",
michael@0 25 category: CATEGORY_WEBDEV,
michael@0 26 severity: SEVERITY_LOG,
michael@0 27 }],
michael@0 28 }).then(() => {
michael@0 29 oldScrollTop = scrollNode.scrollTop;
michael@0 30 isnot(oldScrollTop, 0, "scroll location is not at the top");
michael@0 31
michael@0 32 hud.jsterm.execute("'hello world'", onExecute);
michael@0 33 });
michael@0 34
michael@0 35 function onExecute(msg)
michael@0 36 {
michael@0 37 isnot(scrollNode.scrollTop, oldScrollTop, "scroll location updated");
michael@0 38
michael@0 39 oldScrollTop = scrollNode.scrollTop;
michael@0 40
michael@0 41 msg.scrollIntoView(false);
michael@0 42
michael@0 43 is(scrollNode.scrollTop, oldScrollTop, "scroll location is the same");
michael@0 44
michael@0 45 finishTest();
michael@0 46 }
michael@0 47 }
michael@0 48
michael@0 49 function test() {
michael@0 50 addTab("data:text/html;charset=utf-8,Web Console test for bug 614793: jsterm result scroll");
michael@0 51 browser.addEventListener("load", function onLoad(aEvent) {
michael@0 52 browser.removeEventListener(aEvent.type, onLoad, true);
michael@0 53 openConsole(null, consoleOpened);
michael@0 54 }, true);
michael@0 55 }
michael@0 56

mercurial