1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_result_format_as_string.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 + 1.8 +// Make sure that JS eval result are properly formatted as strings. 1.9 + 1.10 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-result-format-as-string.html"; 1.11 + 1.12 +function test() 1.13 +{ 1.14 + waitForExplicitFinish(); 1.15 + 1.16 + addTab(TEST_URI); 1.17 + 1.18 + gBrowser.selectedBrowser.addEventListener("load", function onLoad() { 1.19 + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); 1.20 + openConsole(null, performTest); 1.21 + }, true); 1.22 +} 1.23 + 1.24 +function performTest(hud) 1.25 +{ 1.26 + hud.jsterm.clearOutput(true); 1.27 + 1.28 + hud.jsterm.execute("document.querySelector('p')", (msg) => { 1.29 + is(hud.outputNode.textContent.indexOf("bug772506_content"), -1, 1.30 + "no content element found"); 1.31 + ok(!hud.outputNode.querySelector("#foobar"), "no #foobar element found"); 1.32 + 1.33 + ok(msg, "eval output node found"); 1.34 + is(msg.textContent.indexOf("<div>"), -1, 1.35 + "<div> string is not displayed"); 1.36 + isnot(msg.textContent.indexOf("<p>"), -1, 1.37 + "<p> string is displayed"); 1.38 + 1.39 + EventUtils.synthesizeMouseAtCenter(msg, {type: "mousemove"}); 1.40 + ok(!gBrowser._bug772506, "no content variable"); 1.41 + 1.42 + finishTest(); 1.43 + }); 1.44 +}