browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +/* vim:set ts=2 sw=2 sts=2 et: */
     1.5 +/*
     1.6 + * Any copyright is dedicated to the Public Domain.
     1.7 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.8 + */
     1.9 +
    1.10 +// Tests that console.group/groupEnd works as intended.
    1.11 +const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 664131: Expand console object with group methods";
    1.12 +
    1.13 +function test() {
    1.14 +  Task.spawn(runner).then(finishTest);
    1.15 +
    1.16 +  function* runner() {
    1.17 +    let {tab} = yield loadTab(TEST_URI);
    1.18 +    let hud = yield openConsole(tab);
    1.19 +    let outputNode = hud.outputNode;
    1.20 +
    1.21 +    hud.jsterm.clearOutput();
    1.22 +
    1.23 +    content.console.group("bug664131a");
    1.24 +
    1.25 +    yield waitForMessages({
    1.26 +      webconsole: hud,
    1.27 +      messages: [{
    1.28 +        text: "bug664131a",
    1.29 +        consoleGroup: 1,
    1.30 +      }],
    1.31 +    });
    1.32 +
    1.33 +    content.console.log("bug664131a-inside");
    1.34 +
    1.35 +    yield waitForMessages({
    1.36 +      webconsole: hud,
    1.37 +      messages: [{
    1.38 +        text: "bug664131a-inside",
    1.39 +        category: CATEGORY_WEBDEV,
    1.40 +        severity: SEVERITY_LOG,
    1.41 +        groupDepth: 1,
    1.42 +      }],
    1.43 +    });
    1.44 +
    1.45 +    content.console.groupEnd("bug664131a");
    1.46 +    content.console.log("bug664131-outside");
    1.47 +
    1.48 +    yield waitForMessages({
    1.49 +      webconsole: hud,
    1.50 +      messages: [{
    1.51 +        text: "bug664131-outside",
    1.52 +        category: CATEGORY_WEBDEV,
    1.53 +        severity: SEVERITY_LOG,
    1.54 +        groupDepth: 0,
    1.55 +      }],
    1.56 +    });
    1.57 +
    1.58 +    content.console.groupCollapsed("bug664131b");
    1.59 +
    1.60 +    yield waitForMessages({
    1.61 +      webconsole: hud,
    1.62 +      messages: [{
    1.63 +        text: "bug664131b",
    1.64 +        consoleGroup: 1,
    1.65 +      }],
    1.66 +    });
    1.67 +
    1.68 +    // Test that clearing the console removes the indentation.
    1.69 +    hud.jsterm.clearOutput();
    1.70 +    content.console.log("bug664131-cleared");
    1.71 +
    1.72 +    yield waitForMessages({
    1.73 +      webconsole: hud,
    1.74 +      messages: [{
    1.75 +        text: "bug664131-cleared",
    1.76 +        category: CATEGORY_WEBDEV,
    1.77 +        severity: SEVERITY_LOG,
    1.78 +        groupDepth: 0,
    1.79 +      }],
    1.80 +    });
    1.81 +  }
    1.82 +}

mercurial