Files
firefox/testing/web-platform/tests/css/cssom/MediaList.html
T
Chris Nardi 9af0ea5c0a Bug 1445393 [wpt PR 10005] - Add and correct CSSOM spec references, a=testonly
Automatic update from web-platform-testsAdd and correct CSSOM spec references

Many CSSOM tests were missing spec references or had incorrect ones; add/update these references.

--
Move GetBoundingRect.html

getBoundingClientRec is defined in CSSOM View, not CSSOM.

wpt-commits: 825f054d0d8f1f60ef13e36b46d6ea97ea87cc15, b52a19067b803b35f9cdd588f8302a289e20446a
wpt-pr: 10005
wpt-commits: 825f054d0d8f1f60ef13e36b46d6ea97ea87cc15, b52a19067b803b35f9cdd588f8302a289e20446a
wpt-pr: 10005
2018-04-15 08:31:19 +01:00

56 lines
3.4 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSSOM - MediaList interface</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#the-medialist-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@media screen and (min-width: 480px), print, projection {}
</style>
<script>
test(function () {
var media = document.styleSheets[0].cssRules[0].media;
assert_equals(media.length, 3, "MediaList length attribute");
assert_equals(media.mediaText, "screen and (min-width: 480px), print, projection", "MediaList mediaText attribute");
assert_equals(media.toString(), "screen and (min-width: 480px), print, projection", "MediaList toString method");
assert_equals(media[0], "screen and (min-width: 480px)", "MediaList indexed getter");
assert_equals(media[1], "print", "MediaList indexed getter");
assert_equals(media[2], "projection", "MediaList indexed getter");
assert_equals(media[3], undefined, "MediaList indexed getter with out of range");
assert_equals(media.item(0), "screen and (min-width: 480px)", "MediaList item method");
assert_equals(media.item(3), null, "MediaList item method");
media.deleteMedium("print");
assert_equals(media.length, 2, "MediaList length attribute after delete method");
assert_equals(media.mediaText, "screen and (min-width: 480px), projection", "MediaList mediaText attribute after delete method");
assert_equals(media.toString(), "screen and (min-width: 480px), projection", "MediaList toString method after delete method");
assert_equals(media[1], "projection", "MediaList indexed getter after delete method");
assert_equals(media[2], undefined, "MediaList indexed getter with out of range after delete method");
assert_equals(media.item(1), "projection", "MediaList indexed getter after delete method");
assert_equals(media.item(2), null, "MediaList item method after delete method");
media.appendMedium("speech");
assert_equals(media.length, 3, "MediaList length attribute after append method");
assert_equals(media.mediaText, "screen and (min-width: 480px), projection, speech", "MediaList mediaText attribute after append method");
assert_equals(media.toString(), "screen and (min-width: 480px), projection, speech", "MediaList toString method after append method");
assert_equals(media[1], "projection", "MediaList indexed getter after append method");
assert_equals(media[2], "speech", "MediaList indexed getter after append method");
assert_equals(media[3], undefined, "MediaList indexed getter with out of range after append method");
assert_equals(media.item(2), "speech", "MediaList item method after append method");
assert_equals(media.item(3), null, "MediaList item method after append method");
media.mediaText = null;
assert_equals(media.mediaText, "", "MediaList mediaText attribute should be empty string in case of null");
assert_equals(media.toString(), "", "MediaList toString method should be empty string in case of null");
var rule = document.styleSheets[0].cssRules[0];
rule.media = "speech";
assert_equals(rule.media.mediaText, "speech", "MediaList mediaText attribute should be updated");
});
</script>
</head>
</html>