Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
anttijk authored Jan 25, 2023
1 parent 43e796e commit 551f57b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions css/mediaqueries/match-media-parsing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-syntax-3/#parse-comma-separated-list-of-component-values">
<script type="text/javascript" src="/resources/testharness.js"></script>
<script type="text/javascript" src="/resources/testharnessreport.js"></script>

<script>
function test_parsing(query, expected) {
test(() => {
const match = window.matchMedia(query);
assert_equals(match.media, expected)
}, "Test parsing '" + query + "' with matchMedia");
}
test_parsing("", "");
test_parsing(" ", "");
test_parsing("all", "all");
test_parsing(" all", "all");
test_parsing(" all ", "all");
test_parsing("all,all", "all, all");
test_parsing(" all , all ", "all, all");
test_parsing("(color)", "(color)");
test_parsing("(color", "(color)");
test_parsing(" (color)", "(color)");
test_parsing(" ( color ) ", "(color)");
test_parsing(" ( color ", "(color)");
test_parsing("color)", "not all");
test_parsing(" color)", "not all");
test_parsing(" color ), ( color", "not all, (color)");
test_parsing(" foo ", "foo");
test_parsing(",", "not all, not all");
test_parsing(" , ", "not all, not all");
test_parsing(",,", "not all, not all, not all");
test_parsing(" , , ", "not all, not all, not all");
test_parsing(" foo,", "foo, not all");
</script>

0 comments on commit 551f57b

Please sign in to comment.