<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<style id="target-style"></style>

<script>
    description("Test the CSSOM serialization of the any-pointer media feature.")

    var testCases = [
        // Case.
        ["(any-pointer)", "(any-pointer)"],
        ["(    any-pointer)", "(any-pointer)"],
        ["(any-pointer    )", "(any-pointer)"],
        ["(    any-pointer    )", "(any-pointer)"],
        ["(any-pointer: fine)", "(any-pointer: fine)"],
        ["(any-pointer: Fine)", "(any-pointer: fine)"],
        ["(any-pointer: FINE)", "(any-pointer: fine)"],
        ["(Any-Pointer: fine)", "(any-pointer: fine)"],
        ["(ANY-POINTER: fine)", "(any-pointer: fine)"],
        ["(Any-Pointer: Fine)", "(any-pointer: fine)"],
        ["(any-pointer: COARSE)", "(any-pointer: coarse)"],
        ["(Any-Pointer: Coarse)", "(any-pointer: coarse)"],
        ["(any-pointer: NONE)", "(any-pointer: none)"],
        ["(Any-Pointer: None)", "(any-pointer: none)"],

        // Spacing.
        ["(any-pointer:fine)", "(any-pointer: fine)"],
        ["(any-pointer: fine)", "(any-pointer: fine)"],
        ["(any-pointer :fine)", "(any-pointer: fine)"],
        ["(any-pointer : fine)", "(any-pointer: fine)"],
        ["(     any-pointer    : fine     )", "(any-pointer: fine)"],
        ["(any-pointer\t:\tfine)", "(any-pointer: fine)"],
    ];

    var targetStyle = document.getElementById('target-style');
    for (var testCase of testCases) {
        targetStyle.innerText = "@media " + testCase[0] + " { }";
        shouldBeEqualToString("document.styleSheets[1].cssRules[0].media.mediaText", testCase[1]);
    }
</script>

<script src="../../resources/js-test-post.js"></script>
</body>
</html>
