Update web-platform-tests to revision 3f9178031eec5374c9a7d5709a7e11ba4a1955ed

This commit is contained in:
WPT Sync Bot 2018-07-22 21:05:03 -04:00
parent 4997ec26c2
commit a5af9a106a
192 changed files with 3943 additions and 1927 deletions

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>textarea maxlength</title>
<link rel="author" title="tigercosmos" href="mailto:phy.tiger@gmail.com">
<link rel=help href="https://html.spec.whatwg.org/multipage/#attr-textarea-maxlength">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<textarea id="none"></textarea>
<textarea id="negative" maxlength="-5"></textarea>
<textarea id="non-numeric" maxlength="not-a-number"></textarea>
<textarea id="assign-negative"></textarea>
<textarea id="assign-non-numeric"></textarea>
<script>
test(
function () {
assert_equals(document.getElementById("none").maxLength, -1);
}, "Unset maxlength is -1");
test(
function () {
assert_equals(document.getElementById("negative").maxLength, -1);
}, "Negative maxlength is always -1");
test(
function () {
assert_equals(document.getElementById("non-numeric").maxLength, -1);
}, "Non-numeric maxlength is -1");
test(
function () {
assert_throws("INDEX_SIZE_ERR", function () {
document.getElementById("assign-negative").maxLength = -5;
});
}, "Assigning negative integer throws IndexSizeError");
test(
function () {
document.getElementById("assign-non-numeric").maxLength = "not-a-number";
assert_equals(document.getElementById("assign-non-numeric").maxLength, 0);
}, "Assigning non-numeric to maxlength sets maxlength to 0");
</script>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>textarea minlength</title>
<link rel="author" title="tigercosmos" href="mailto:phy.tiger@gmail.com">
<link rel=help href="https://html.spec.whatwg.org/multipage/#attr-textarea-minlength">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<textarea id="none"></textarea>
<textarea id="negative" minlength=-5></textarea>
<textarea id="non-numeric" minlength="not-a-number"></textarea>
<textarea id="assign-negative"></textarea>
<textarea id="assign-non-numeric"></textarea>
<script>
test(
function () {
assert_equals(document.getElementById("none").minLength, -1);
}, "Unset minlength is -1");
test(
function () {
assert_equals(document.getElementById("negative").minLength, -1);
}, "Negative minlength is always -1");
test(
function () {
assert_equals(document.getElementById("non-numeric").minLength, -1);
}, "Non-numeric minlength is -1");
test(
function () {
assert_throws("INDEX_SIZE_ERR", function () {
document.getElementById("assign-negative").minLength = -5;
});
}, "Assigning negative integer throws IndexSizeError");
test(
function () {
document.getElementById("assign-non-numeric").minLength = "not-a-number";
assert_equals(document.getElementById("assign-non-numeric").minLength, 0);
}, "Assigning non-numeric to minlength sets minlength to 0");
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<title>The textLengh IDL attribute</title>
<meta content="charset=utf-16">
<link rel="author" title="tigercosmos" href="mailto:phy.tiger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea-textlength">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<textarea id="textarea"></textarea>
<script>
var textarea = document.getElementById("textarea");
test(function () {
textarea.value= "Hello, World!";
assert_equals(textarea.textLength, 13);
textarea.value = "\u4f60\u597d\uff0c\u4e16\u754c\uff01"; //你好,世界!
assert_equals(textarea.textLength, 6);
}, "Textarea's 'testLength' should work for utf-16.");
</script>

View file

@ -0,0 +1,27 @@
<!doctype html>
<meta charset="utf-8">
<title>HTML Test: &lt;textarea&gt; validity state is correct after a clone</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-textarea-element">
<link rel="help" href="https://bugzil.la/1472169">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
let form = document.createElement("form");
let textarea = document.createElement("textarea");
textarea.required = true;
textarea.appendChild(document.createTextNode("A"));
form.appendChild(textarea);
assert_true(textarea.validity.valid);
let formClone = form.cloneNode(true);
assert_equals(
formClone.querySelector('textarea').validity.valid,
textarea.validity.valid,
"Validity state should be preserved after a clone"
);
}, "<textarea> validity state should be preserved after a clone");
</script>