Implement MediaList interface

This commit is contained in:
Nazım Can Altınova 2016-12-02 01:19:20 +03:00
parent 5abbc9f696
commit c052835281
10 changed files with 207 additions and 32 deletions

View file

@ -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

View file

@ -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",

View file

@ -140,6 +140,7 @@ test_interfaces([
"KeyboardEvent",
"Location",
"MediaError",
"MediaList",
"MediaQueryList",
"MessageEvent",
"MimeType",

View 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>