mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Implement MediaList interface
This commit is contained in:
parent
5abbc9f696
commit
c052835281
10 changed files with 207 additions and 32 deletions
|
@ -75,33 +75,9 @@
|
|||
[SVGElement interface: attribute style]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: attribute mediaText]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: attribute length]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: operation item(unsigned long)]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: operation appendMedium(DOMString)]
|
||||
expected: FAIL
|
||||
|
||||
[MediaList interface: operation deleteMedium(DOMString)]
|
||||
expected: FAIL
|
||||
|
||||
[StyleSheet interface: attribute type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -177,9 +153,6 @@
|
|||
[CSSImportRule interface: attribute styleSheet]
|
||||
expected: FAIL
|
||||
|
||||
[CSSMediaRule interface: attribute media]
|
||||
expected: FAIL
|
||||
|
||||
[CSSPageRule interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -39677,6 +39677,12 @@
|
|||
"deleted_reftests": {},
|
||||
"items": {
|
||||
"testharness": {
|
||||
"cssom/MediaList.html": [
|
||||
{
|
||||
"path": "cssom/MediaList.html",
|
||||
"url": "/cssom/MediaList.html"
|
||||
}
|
||||
],
|
||||
"cssom/shorthand-serialization.html": [
|
||||
{
|
||||
"path": "cssom/shorthand-serialization.html",
|
||||
|
|
|
@ -140,6 +140,7 @@ test_interfaces([
|
|||
"KeyboardEvent",
|
||||
"Location",
|
||||
"MediaError",
|
||||
"MediaList",
|
||||
"MediaQueryList",
|
||||
"MessageEvent",
|
||||
"MimeType",
|
||||
|
|
43
tests/wpt/web-platform-tests/cssom/MediaList.html
Normal file
43
tests/wpt/web-platform-tests/cssom/MediaList.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSOM - MediaList interface</title>
|
||||
<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[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[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[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");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue