browser/devtools/webconsole/test/browser_webconsole_output_order.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 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 // Tests that any output created from calls to the console API comes after the
     7 // echoed JavaScript.
     9 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
    11 function test() {
    12   addTab(TEST_URI);
    13   browser.addEventListener("load", function onLoad() {
    14     browser.removeEventListener("load", onLoad, true);
    15     openConsole(null, testOutputOrder);
    16   }, true);
    17 }
    19 function testOutputOrder(hud) {
    20   let jsterm = hud.jsterm;
    21   let outputNode = jsterm.outputNode;
    23   jsterm.clearOutput();
    24   jsterm.execute("console.log('foo', 'bar');");
    26   waitForMessages({
    27     webconsole: hud,
    28     messages: [{
    29       text: "console.log('foo', 'bar');",
    30       category: CATEGORY_INPUT,
    31     },
    32     {
    33       text: "undefined",
    34       category: CATEGORY_OUTPUT,
    35     },
    36     {
    37       text: '"foo" "bar"',
    38       category: CATEGORY_WEBDEV,
    39       severity: SEVERITY_LOG,
    40     }],
    41   }).then(([function_call, result, console_message]) => {
    42     let fncall_node = [...function_call.matched][0];
    43     let result_node = [...result.matched][0];
    44     let console_message_node = [...console_message.matched][0];
    45     is(fncall_node.nextElementSibling, result_node,
    46        "console.log() is followed by undefined");
    47     is(result_node.nextElementSibling, console_message_node,
    48        "undefined is followed by 'foo' 'bar'");
    49     finishTest();
    50   });
    51 }

mercurial