browser/devtools/webconsole/test/browser_result_format_as_string.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 /* Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/ */
     5 // Make sure that JS eval result are properly formatted as strings.
     7 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-result-format-as-string.html";
     9 function test()
    10 {
    11   waitForExplicitFinish();
    13   addTab(TEST_URI);
    15   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    16     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    17     openConsole(null, performTest);
    18   }, true);
    19 }
    21 function performTest(hud)
    22 {
    23   hud.jsterm.clearOutput(true);
    25   hud.jsterm.execute("document.querySelector('p')", (msg) => {
    26     is(hud.outputNode.textContent.indexOf("bug772506_content"), -1,
    27        "no content element found");
    28     ok(!hud.outputNode.querySelector("#foobar"), "no #foobar element found");
    30     ok(msg, "eval output node found");
    31     is(msg.textContent.indexOf("<div>"), -1,
    32        "<div> string is not displayed");
    33     isnot(msg.textContent.indexOf("<p>"), -1,
    34           "<p> string is displayed");
    36     EventUtils.synthesizeMouseAtCenter(msg, {type: "mousemove"});
    37     ok(!gBrowser._bug772506, "no content variable");
    39     finishTest();
    40   });
    41 }

mercurial