summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/inspector/error-warning-count.html
blob: 9f6b9c23fcfc36bc793ad12b63e811840a2f170d (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
<script>
    function clickHandler(errors, warnings)
    {
        return function()
        {
            for (var i = 0; i < errors; ++i)
                console.error("Error " + (i + 1));
            for (var i = 0; i < warnings; ++i)
                console.warn("Warning " + (i + 1));
        }
    }

    function loaded()
    {
        var tests = [
            { errors: 0, warnings: 0 },
            { errors: 1, warnings: 0 },
            { errors: 2, warnings: 0 },
            { errors: 0, warnings: 1 },
            { errors: 0, warnings: 2 },
            { errors: 1, warnings: 1 },
            { errors: 1, warnings: 2 },
            { errors: 2, warnings: 1 },
            { errors: 2, warnings: 2 },
            { errors: 100, warnings: 100 },
        ];

        for (var i in tests) {
            var test = tests[i];

            var button = document.createElement("button");
            var content = "";
            if (!test.errors && !test.warnings)
                content = "(nothing)";
            else {
                if (test.errors > 0)
                    content += test.errors + " error" + (test.errors != 1 ? "s" : "");
                if (test.warnings > 0) {
                    if (content.length)
                        content += ", ";
                    content += test.warnings + " warning" + (test.warnings != 1 ? "s" : "")
                }
            }
            button.innerText = content;
            button.onclick = clickHandler(test.errors, test.warnings);
            var p = document.createElement("p");
            p.appendChild(button);
            document.body.appendChild(p);
        }
    }
</script>
<body onload="loaded()">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=18650">Bug 18650:
Errors/warnings in Inspector should be visible outside of Resources</a>.</p>
<p>To test, open the Inspector and click one of the buttons below. You should
see an error and/or warning count in the Inspector's status bar. Clicking on
the error/warning count should open the Console. Hovering over the
error/warning count should show you a tooltip that matches the text in the
button you clicked.</p>
<p>Note: You must reload the page between each button press.</p>