Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: LayoutTests/fast/forms/textarea-maxlength.html

Issue 22590003: input/textarea: Count value length with the standard way. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/forms/textarea-maxlength.html
diff --git a/LayoutTests/fast/forms/textarea-maxlength.html b/LayoutTests/fast/forms/textarea-maxlength.html
index d34a8b43aeab6dc406eb35c2e5da4104cc731fe7..b9e9db22ac2c8842f2531faba87d7f8f719dfb75 100644
--- a/LayoutTests/fast/forms/textarea-maxlength.html
+++ b/LayoutTests/fast/forms/textarea-maxlength.html
@@ -119,11 +119,11 @@ var fancyX = "x\u0305\u0332";// + String.fromCharCode(0x305) + String.fromCharCo
// u10000 is one character consisted of a surrogate pair.
var u10000 = "\ud800\udc00";
-// Inserts 5 code-points in UTF-16
+debug('Inserts 2 normal characters + a combining letter with 3 code points into a maxlength=3 element.')
createFocusedTextAreaWithMaxLength(3);
document.execCommand('insertText', false, 'AB' + fancyX);
-shouldBe('textArea.value', '"AB" + fancyX');
-shouldBe('textArea.value.length', '5');
+shouldBeEqualToString('textArea.value', 'ABx');
+shouldBe('textArea.value.length', '3');
createFocusedTextAreaWithMaxLength(3);
textArea.value = 'AB' + fancyX;
@@ -131,11 +131,11 @@ textArea.setSelectionRange(2, 5); // Select fancyX
document.execCommand('insertText', false, 'CDE');
shouldBe('textArea.value', '"ABC"');
-// Inserts 4 code-points in UTF-16
+debug('Inserts 2 normal characters + one surrogate pair into a maxlength=3 element');
createFocusedTextAreaWithMaxLength(3);
document.execCommand('insertText', false, 'AB' + u10000);
-shouldBe('textArea.value', '"AB" + u10000');
-shouldBe('textArea.value.length', '4');
+shouldBeEqualToString('textArea.value', 'AB');
+shouldBe('textArea.value.length', '2');
createFocusedTextAreaWithMaxLength(3);
textArea.value = 'AB' + u10000;
« no previous file with comments | « LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt ('k') | LayoutTests/fast/forms/textarea-maxlength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698