browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial