summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/style-enumerate-properties.html
blob: 350420cde67f7a361b6a6253d5ed3c5e63adc43c (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
<head>
    <script src="../../resources/js-test.js"></script>
    <script>
        if (window.testRunner)
            testRunner.dumpAsText();


    </script>
</head>
<body style="text-decoration: underline; border-top-color: green">
    <div id="description">This test makes sure that CSSStyleDeclaration enumerates JavaScript properties for defined and non-defined CSS properties, indexed properties, and properties defined on the prototype. See <a href="https://bugs.webkit.org/show_bug.cgi?id=23946">Bug 23946</a>.</div>
    <div id="console"></div>
    <script>
        shouldBe("document.body.style.length", "4");
        shouldBeTrue("'0' in document.body.style");
        shouldBeTrue("'1' in document.body.style");
        shouldBeTrue("'textDecoration' in document.body.style");
        shouldBeTrue("'textDecorationLine' in document.body.style");
        shouldBeTrue("'textDecorationStyle' in document.body.style");
        shouldBeTrue("'textDecorationColor' in document.body.style");
        shouldBeTrue("'borderTopColor' in document.body.style");
        shouldBeTrue("'border' in document.body.style");
        shouldBeTrue("'font' in document.body.style");
        shouldBeTrue("'webkitTransform' in document.body.style");
        shouldBeTrue("'WebkitTransform' in document.body.style");
        shouldBeFalse("'bogus-random-String' in document.body.style");
        shouldBeTrue("'cssText' in document.body.style");

        // Test CSS property order.
        var started;
        var cssPropertyCount = 0;
        var previous;
        var seenFilter;
        for (var p in document.body.style) {
            if (p === "alignmentBaseline")
                started = true;
            if (!started)
                continue;
            if (p === "filter")
                seenFilter = true;
            if (previous && previous >= p) {
                testFailed("Invalid CSS-mapped property order: '" + p + "' after '" + previous + "'");
                break;
            }
            if (++cssPropertyCount <= 150)
                previous = p;
            else {
                if (seenFilter)
                    testPassed("The CSS property order is correct");
                else
                    testFailed("The 'filter' property was not enumerated");
                break;
            }
        }
    </script>
</body>