<!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 pointer media feature.")

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

        // Spacing.
        ["(pointer:fine)", "(pointer: fine)"],
        ["(pointer: fine)", "(pointer: fine)"],
        ["(pointer :fine)", "(pointer: fine)"],
        ["(pointer : fine)", "(pointer: fine)"],
        ["(     pointer    : fine     )", "(pointer: fine)"],
        ["(pointer\t:\tfine)", "(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>
