browser/devtools/webconsole/test/browser_result_format_as_string.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 /* 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