blob: d24f7110b3c207878600ed02e90345e70ffd93eb [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Media Query List syntax</title>
<link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax">
<script type="text/javascript" src="../../resources/testharness.js"></script>
<script type="text/javascript" src="../../resources/testharnessreport.js"></script>
<style id="sheet">/**/</style>
<script>
var tests = [
[ "@media all, not,{}", "all, not all, not all" , "Media query error #1" ],
[ "@media screen, all and f() {}", "screen, not all", "Media query error #2" ],
[ "@media not and (color), #screen, screen {}", "not all, not all, screen", "Media query error #3" ],
[ "@media all; @media tv {}", "tv", "Media query error #4" ],
[ "@media ({ block, }), tv {}", "not all, tv", "Media query error #5" ],
[ "@media screen and(color), tv {}", "not all, tv", "Media query error #6" ],
[ "@media all and (color) and (f() {}), tv {}", "not all, tv", "Media query error #7" ],
[ "@media tv, all or (nothing) {}", "tv, not all", "Media query error #8" ],
[ "@media tv, all and (color) tv {}", "tv, not all", "Media query error #9" ]
];
var cdataNode = document.getElementById("sheet").firstChild;
for (var i=0; i < tests.length; i++) {
cdataNode.data = tests[i][0];
if (document.styleSheets[0].cssRules.length > 0 &&
document.styleSheets[0].cssRules[0].type == 4) {
result = document.styleSheets[0].cssRules[0].media.mediaText;
}
else {
result = "MEDIA RULE DROPPED!";
}
test(function() {
assert_equals(result, tests[i][1]);
}, tests[i][2]);
}
</script>
</head>
<body>
<div id="log"></div>
</body>
</html>