|
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 // Test that console.assert() works as expected (i.e. outputs only on falsy |
|
6 // asserts). See bug 760193. |
|
7 |
|
8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-assert.html"; |
|
9 |
|
10 function test() { |
|
11 addTab(TEST_URI); |
|
12 browser.addEventListener("load", function onLoad() { |
|
13 browser.removeEventListener("load", onLoad, true); |
|
14 openConsole(null, consoleOpened); |
|
15 }, true); |
|
16 } |
|
17 |
|
18 function consoleOpened(hud) { |
|
19 waitForMessages({ |
|
20 webconsole: hud, |
|
21 messages: [{ |
|
22 text: "start", |
|
23 category: CATEGORY_WEBDEV, |
|
24 severity: SEVERITY_LOG, |
|
25 }, |
|
26 { |
|
27 text: "false assert", |
|
28 category: CATEGORY_WEBDEV, |
|
29 severity: SEVERITY_ERROR, |
|
30 }, |
|
31 { |
|
32 text: "falsy assert", |
|
33 category: CATEGORY_WEBDEV, |
|
34 severity: SEVERITY_ERROR, |
|
35 }, |
|
36 { |
|
37 text: "end", |
|
38 category: CATEGORY_WEBDEV, |
|
39 severity: SEVERITY_LOG, |
|
40 }], |
|
41 }).then(() => { |
|
42 let nodes = hud.outputNode.querySelectorAll(".message"); |
|
43 is(nodes.length, 4, "only four messages are displayed, no output from the true assert"); |
|
44 finishTest(); |
|
45 }); |
|
46 |
|
47 let button = content.document.querySelector("button"); |
|
48 ok(button, "we have the button"); |
|
49 EventUtils.sendMouseEvent({ type: "click" }, button, content); |
|
50 } |