mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180. - Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
parent
fb4f421c8b
commit
296fa2512b
21852 changed files with 2080936 additions and 892894 deletions
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>DOMStringList IDL tests</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
|
||||
<h1>DOMStringList IDL tests</h1>
|
||||
<div id=log></div>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
async_test(function(t) {
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", "domstringlist.idl");
|
||||
request.send();
|
||||
request.onload = t.step_func(function() {
|
||||
var idlArray = new IdlArray();
|
||||
var idls = request.responseText;
|
||||
|
||||
idlArray.add_idls(idls);
|
||||
|
||||
idlArray.add_objects({
|
||||
DOMStringList: ['location.ancestorOrigins'],
|
||||
});
|
||||
|
||||
idlArray.test();
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
|
||||
|
||||
async_test(function(t) {
|
||||
var request = new XMLHttpRequest();
|
||||
request.open("GET", "domstringlist.idl");
|
||||
request.send();
|
||||
request.onload = t.step_func(function() {
|
||||
var idlArray = new IdlArray();
|
||||
var idls = request.responseText;
|
||||
|
||||
idlArray.add_idls(idls);
|
||||
|
||||
idlArray.add_objects({
|
||||
DOMStringList: [],
|
||||
});
|
||||
idlArray.test();
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
|
||||
done();
|
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
<title>DOMStringList</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
// Returns a promise that resolves to a DOMStringList with
|
||||
// the requested entries. Relies on Indexed DB.
|
||||
function createDOMStringList(entries) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dbname = String(self.location + Math.random());
|
||||
const request = indexedDB.open(dbname);
|
||||
request.onerror = () => reject(request.error);
|
||||
request.onupgradeneeded = () => {
|
||||
const db = request.result;
|
||||
entries.forEach(entry => db.createObjectStore(entry));
|
||||
const dsl = db.objectStoreNames;
|
||||
resolve(dsl);
|
||||
request.transaction.abort();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function dsl_test(entries, func, description) {
|
||||
promise_test(t => createDOMStringList(entries).then(dsl => func(t, dsl)),
|
||||
description);
|
||||
}
|
||||
|
||||
dsl_test(['a', 'b', 'c'], (t, dsl) => {
|
||||
assert_equals(dsl.length, 3, 'length attribute');
|
||||
}, 'DOMStringList: length attribute');
|
||||
|
||||
dsl_test(['a', 'b', 'c'], (t, dsl) => {
|
||||
assert_equals(dsl.item(0), 'a', 'item method');
|
||||
assert_equals(dsl.item(1), 'b', 'item method');
|
||||
assert_equals(dsl.item(2), 'c', 'item method');
|
||||
assert_equals(dsl.item(3), null, 'item method out of range');
|
||||
assert_equals(dsl.item(-1), null, 'item method out of range');
|
||||
assert_throws(TypeError(), () => dsl.item(),
|
||||
'item method should throw if called without enough args');
|
||||
}, 'DOMStringList: item() method');
|
||||
|
||||
dsl_test(['a', 'b', 'c'], (t, dsl) => {
|
||||
assert_equals(dsl[0], 'a', 'indexed getter');
|
||||
assert_equals(dsl[1], 'b', 'indexed getter');
|
||||
assert_equals(dsl[2], 'c', 'indexed getter');
|
||||
assert_equals(dsl[3], undefined, 'indexed getter out of range');
|
||||
assert_equals(dsl[-1], undefined, 'indexed getter out of range');
|
||||
}, 'DOMStringList: indexed getter');
|
||||
|
||||
dsl_test(['a', 'b', 'c'], (t, dsl) => {
|
||||
assert_true(dsl.contains('a'), 'contains method matched');
|
||||
assert_true(dsl.contains('b'), 'contains method matched');
|
||||
assert_true(dsl.contains('c'), 'contains method matched');
|
||||
assert_false(dsl.contains(''), 'contains method unmatched');
|
||||
assert_false(dsl.contains('d'), 'contains method unmatched');
|
||||
assert_throws(TypeError(), () => dsl.contains(),
|
||||
'contains method should throw if called without enough args');
|
||||
}, 'DOMStringList: contains() method');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
[Exposed=(Window,Worker)]
|
||||
interface DOMStringList {
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString? item(unsigned long index);
|
||||
boolean contains(DOMString string);
|
||||
};
|
|
@ -7,8 +7,8 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<form id="f1">
|
||||
<input type="radio" id="r1">
|
||||
<keygen id="kg" name="key"></keygen>
|
||||
<input type="radio" id="r1" name="ra">
|
||||
<keygen id="kg" name="key"></keygen> <!-- we test that it does *not* appear in form.elements -->
|
||||
</form>
|
||||
<form id="f2">
|
||||
<table>
|
||||
|
@ -39,7 +39,7 @@ setup(function () {
|
|||
|
||||
//length
|
||||
test(function () {
|
||||
assert_equals(coll1.length, 2, "The length attribute is incorrect.");
|
||||
assert_equals(coll1.length, 1, "The length attribute is incorrect.");
|
||||
assert_equals(coll2.length, 4, "The length attribute is incorrect.");
|
||||
}, "The length attribute must return the number of elements in the form");
|
||||
|
||||
|
@ -83,17 +83,22 @@ test(function () {
|
|||
}, "The namedItem(name) must return null if there is no matched element");
|
||||
|
||||
test(function () {
|
||||
assert_equals(coll1.namedItem("kg"), document.getElementById("kg"), "Controls can be named by 'id' attribute.");
|
||||
assert_equals(coll1.namedItem("key"), document.getElementById("kg"), "Controls can be named by 'name' attribute.");
|
||||
assert_equals(coll1.namedItem("r1"), document.getElementById("r1"), "Controls can be named by 'id' attribute.");
|
||||
assert_equals(coll1.namedItem("ra"), document.getElementById("r1"), "Controls can be named by 'name' attribute.");
|
||||
}, "Controls can be indexed by id or name attribute");
|
||||
|
||||
test(function () {
|
||||
assert_equals(coll1.namedItem("kg"), null, "Keygen does not show up when queried by id.");
|
||||
assert_equals(coll1.namedItem("key"), null, "Keygen does not show up when queried by name.");
|
||||
}, "Keygen controls do not show up at all");
|
||||
|
||||
test(function () {
|
||||
assert_equals(coll2.namedItem("btn").length, 2, "The length attribute should be 2.");
|
||||
}, "The namedItem(name) must return the items with id or name attribute");
|
||||
|
||||
//various controls in fieldset and form
|
||||
var containers = ["form", "fieldset"],
|
||||
controls = ["button", "fieldset", "input", "keygen", "object", "output", "select", "textarea"];
|
||||
controls = ["button", "fieldset", "input", "object", "output", "select", "textarea"];
|
||||
for (var m = 0; m < containers.length; m++) {
|
||||
test(function () {
|
||||
var container = document.createElement(containers[m]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue