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

    var testCases = [
        // Case.
        ["(any-hover)", "(any-hover)"],
        ["(    any-hover)", "(any-hover)"],
        ["(any-hover    )", "(any-hover)"],
        ["(    any-hover    )", "(any-hover)"],
        ["(any-hover: hover)", "(any-hover: hover)"],
        ["(any-hover: Hover)", "(any-hover: hover)"],
        ["(any-hover: HOVER)", "(any-hover: hover)"],
        ["(Any-Hover: hover)", "(any-hover: hover)"],
        ["(ANY-HOVER: hover)", "(any-hover: hover)"],
        ["(Any-Hover: Hover)", "(any-hover: hover)"],
        ["(any-hover: NONE)", "(any-hover: none)"],
        ["(Any-Hover: None)", "(any-hover: none)"],

        // Spacing.
        ["(any-hover:hover)", "(any-hover: hover)"],
        ["(any-hover: hover)", "(any-hover: hover)"],
        ["(any-hover :hover)", "(any-hover: hover)"],
        ["(any-hover : hover)", "(any-hover: hover)"],
        ["(     any-hover    : hover     )", "(any-hover: hover)"],
        ["(any-hover\t:\thover)", "(any-hover: hover)"],

        // Obsolete values.
        ["(any-hover: ON-DEMAND)", "(any-hover: ON-DEMAND)"],
        ["(Any-Hover: On-demand)", "(Any-Hover: On-demand)"],
    ];

    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>
