| |
1 /* vim:set ts=2 sw=2 sts=2 et: */ |
| |
2 /* |
| |
3 * Any copyright is dedicated to the Public Domain. |
| |
4 * http://creativecommons.org/publicdomain/zero/1.0/ |
| |
5 */ |
| |
6 |
| |
7 // Tests that console.group/groupEnd works as intended. |
| |
8 const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 664131: Expand console object with group methods"; |
| |
9 |
| |
10 function test() { |
| |
11 Task.spawn(runner).then(finishTest); |
| |
12 |
| |
13 function* runner() { |
| |
14 let {tab} = yield loadTab(TEST_URI); |
| |
15 let hud = yield openConsole(tab); |
| |
16 let outputNode = hud.outputNode; |
| |
17 |
| |
18 hud.jsterm.clearOutput(); |
| |
19 |
| |
20 content.console.group("bug664131a"); |
| |
21 |
| |
22 yield waitForMessages({ |
| |
23 webconsole: hud, |
| |
24 messages: [{ |
| |
25 text: "bug664131a", |
| |
26 consoleGroup: 1, |
| |
27 }], |
| |
28 }); |
| |
29 |
| |
30 content.console.log("bug664131a-inside"); |
| |
31 |
| |
32 yield waitForMessages({ |
| |
33 webconsole: hud, |
| |
34 messages: [{ |
| |
35 text: "bug664131a-inside", |
| |
36 category: CATEGORY_WEBDEV, |
| |
37 severity: SEVERITY_LOG, |
| |
38 groupDepth: 1, |
| |
39 }], |
| |
40 }); |
| |
41 |
| |
42 content.console.groupEnd("bug664131a"); |
| |
43 content.console.log("bug664131-outside"); |
| |
44 |
| |
45 yield waitForMessages({ |
| |
46 webconsole: hud, |
| |
47 messages: [{ |
| |
48 text: "bug664131-outside", |
| |
49 category: CATEGORY_WEBDEV, |
| |
50 severity: SEVERITY_LOG, |
| |
51 groupDepth: 0, |
| |
52 }], |
| |
53 }); |
| |
54 |
| |
55 content.console.groupCollapsed("bug664131b"); |
| |
56 |
| |
57 yield waitForMessages({ |
| |
58 webconsole: hud, |
| |
59 messages: [{ |
| |
60 text: "bug664131b", |
| |
61 consoleGroup: 1, |
| |
62 }], |
| |
63 }); |
| |
64 |
| |
65 // Test that clearing the console removes the indentation. |
| |
66 hud.jsterm.clearOutput(); |
| |
67 content.console.log("bug664131-cleared"); |
| |
68 |
| |
69 yield waitForMessages({ |
| |
70 webconsole: hud, |
| |
71 messages: [{ |
| |
72 text: "bug664131-cleared", |
| |
73 category: CATEGORY_WEBDEV, |
| |
74 severity: SEVERITY_LOG, |
| |
75 groupDepth: 0, |
| |
76 }], |
| |
77 }); |
| |
78 } |
| |
79 } |