Bug 1477562 [wpt PR 12127] - add TextLength, a=testonly

Automatic update from web-platform-testsMerge pull request #12127 from web-platform-tests/sync_aa8fd3b809b64221737b6993205e71586a66a77f

Merge pull request #12127 from sync_aa8fd3b809b64221737b6993205e71586a66a77f
--

wpt-commits: a3f8def941ae2d73052aeefed4e212fa3766df99
wpt-pr: 12127
This commit is contained in:
Servo WPT Sync 2018-07-25 18:38:47 +00:00 committed by James Graham
parent 4585510f10
commit d1c8ccee63
2 changed files with 29 additions and 0 deletions

View File

@ -347952,6 +347952,12 @@
{}
]
],
"html/semantics/forms/the-textarea-element/textarea-textLength.html": [
[
"/html/semantics/forms/the-textarea-element/textarea-textLength.html",
{}
]
],
"html/semantics/forms/the-textarea-element/textarea-type.html": [
[
"/html/semantics/forms/the-textarea-element/textarea-type.html",
@ -587323,6 +587329,10 @@
"5f5932aeba8a0a7da66ee006a6e604780210d57b",
"testharness"
],
"html/semantics/forms/the-textarea-element/textarea-textLength.html": [
"0f9b8cdaace12d4f4e7fbd57a90fcba7e826ced5",
"testharness"
],
"html/semantics/forms/the-textarea-element/textarea-type.html": [
"81a270bc3c9304f8b2e7dd526519f4eab7d94f45",
"testharness"

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>