Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -52,4 +52,36 @@ test(function() {
assert_equals(document.embeds, document.plugins,
"embeds should be the same as plugins");
}, "Two plugins");
test(function() {
var embed1 = document.createElement("embed"),
embed2 = document.createElement("embed");
document.body.appendChild(embed1);
this.add_cleanup(function() { document.body.removeChild(embed1) });
var embeds = document.embeds;
assert_true(embeds instanceof HTMLCollection);
assert_equals(embeds.length, 1);
document.body.appendChild(embed2);
assert_equals(embeds.length, 2);
document.body.removeChild(embed2);
assert_equals(embeds.length, 1);
}, "Document.embeds should be a live collection");
test(function() {
var embed1 = document.createElement("embed"),
embed2 = document.createElement("embed");
document.body.appendChild(embed1);
this.add_cleanup(function() { document.body.removeChild(embed1) });
var pls = document.plugins;
assert_true(pls instanceof HTMLCollection);
assert_equals(pls.length, 1);
document.body.appendChild(embed2);
assert_equals(pls.length, 2);
document.body.removeChild(embed2);
assert_equals(pls.length, 1);
}, "Document.plugins should be a live collection");
</script>

View file

@ -67,4 +67,17 @@ test(function() {
var result = Object.getOwnPropertyNames(document.forms);
assert_array_equals(result, ["0", "1", "2", "form1", "form2"])
}, "document.forms getOwnPropertyNames")
test(function() {
var forms = document.forms;
assert_true(forms instanceof HTMLCollection);
assert_equals(forms.length, 3);
var form = document.createElement("form");
document.body.appendChild(form);
assert_equals(forms.length, 4);
document.body.removeChild(form);
assert_equals(forms.length, 3);
}, "Document.forms should be a live collection");
</script>

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>Document.getElementsByName: liveness</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var input = document.createElement("input"),
embed = document.createElement("embed");
input.setAttribute("name", "test");
input.setAttribute("type", "text");
embed.setAttribute("name", "test");
document.body.appendChild(input);
this.add_cleanup(function() { document.body.removeChild(input) });
var e = document.getElementsByName("test");
assert_true(e instanceof NodeList);
assert_equals(e.length, 1);
document.body.appendChild(embed);
assert_equals(e.length, 2);
document.body.removeChild(embed);
assert_equals(e.length, 1);
}, "Document.getElementsByName() should be a live collection");
</script>

View file

@ -102,4 +102,18 @@ test(function() {
assert_equals(c.namedItem(""), null);
assert_false("" in c, '"" in c');
}, "The empty string should not be in the collections");
test(function() {
var div = document.getElementById("test");
var imgs = document.images;
assert_true(imgs instanceof HTMLCollection);
assert_equals(imgs.length, 10);
var img = document.createElement("img");
div.appendChild(img);
assert_equals(imgs.length, 11);
div.removeChild(img);
assert_equals(imgs.length, 10);
}, "Document.images should be a live collection");
</script>

View file

@ -0,0 +1,27 @@
<!doctype html>
<meta charset=utf-8>
<title>Document.links</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<div id=test>
<a href=""></a>
<a href=""></a>
</div>
<script>
test(function() {
var div = document.getElementById("test");
var links = document.links;
assert_true(links instanceof HTMLCollection);
assert_equals(links.length, 2);
var a = document.createElement("a");
a.setAttribute("href", "");
div.appendChild(a);
assert_equals(links.length, 3);
div.removeChild(a);
assert_equals(links.length, 2);
}, "Document.links should be a live collection");
</script>

View file

@ -0,0 +1,21 @@
<!doctype html>
<meta charset=utf-8>
<title>Document.scripts</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function() {
var scripts = document.scripts;
assert_true(scripts instanceof HTMLCollection);
assert_equals(scripts.length, 3);
var script = document.createElement("script");
document.body.appendChild(script);
assert_equals(scripts.length, 4);
document.body.removeChild(script);
assert_equals(scripts.length, 3);
}, "Document.scripts should be a live collection");
</script>