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.

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

mercurial