browser/devtools/webconsole/test/browser_result_format_as_string.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c0dfe5202005
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/ */
4
5 // Make sure that JS eval result are properly formatted as strings.
6
7 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-result-format-as-string.html";
8
9 function test()
10 {
11 waitForExplicitFinish();
12
13 addTab(TEST_URI);
14
15 gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
16 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
17 openConsole(null, performTest);
18 }, true);
19 }
20
21 function performTest(hud)
22 {
23 hud.jsterm.clearOutput(true);
24
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");
29
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");
35
36 EventUtils.synthesizeMouseAtCenter(msg, {type: "mousemove"});
37 ok(!gBrowser._bug772506, "no content variable");
38
39 finishTest();
40 });
41 }

mercurial