summaryrefslogtreecommitdiff
path: root/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
blob: cfc1c8c378e8a6adf36572bb687b19d34f38ff0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* vim:set ts=2 sw=2 sts=2 et: */
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">test repeated' +
                 ' css warnings</div><p style="-moz-opacity:0">hi</p>';
let hud;

"use strict";

/**
 * Unit test for bug 611795:
 * Repeated CSS messages get collapsed into one.
 */

let test = asyncTest(function* () {
  yield loadTab(TEST_URI);

  hud = yield openConsole();
  hud.jsterm.clearOutput(true);

  BrowserReload();
  yield loadBrowser(gBrowser.selectedBrowser);

  yield onContentLoaded();
  yield testConsoleLogRepeats();

  hud = null;
});

function onContentLoaded()
{
  let cssWarning = "Unknown property '-moz-opacity'.  Declaration dropped.";

  return waitForMessages({
    webconsole: hud,
    messages: [{
      text: cssWarning,
      category: CATEGORY_CSS,
      severity: SEVERITY_WARNING,
      repeats: 2,
    }],
  });
}

function testConsoleLogRepeats()
{
  let jsterm = hud.jsterm;

  jsterm.clearOutput();

  jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a line of reasonably long text that I will use to verify that the repeated text node is of an appropriate size.');");
  jsterm.execute();

  return waitForMessages({
    webconsole: hud,
    messages: [{
      text: "this is a line of reasonably long text",
      category: CATEGORY_WEBDEV,
      severity: SEVERITY_LOG,
      repeats: 10,
    }],
  });
}