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

Unified Diff: LayoutTests/fast/forms/input-text-paste-maxlength.html

Issue 22590003: input/textarea: Count value length with the standard way. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comment in a test 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/input-text-paste-maxlength.html
diff --git a/LayoutTests/fast/forms/input-text-paste-maxlength.html b/LayoutTests/fast/forms/input-text-paste-maxlength.html
index 8eee4d43e00af081ad07fec63a2e35e7651d54bb..e03621916028ce06f2f2b54a2f4d1be5ad5c38d9 100644
--- a/LayoutTests/fast/forms/input-text-paste-maxlength.html
+++ b/LayoutTests/fast/forms/input-text-paste-maxlength.html
@@ -16,7 +16,7 @@
<input type="text" id="i" size="5" maxlength="4">
<input type="text" id="h" size="5">
<input type="text" id="g" size="5">
-<input type="text" id="k" size="5" maxlength="4">
+<input type="text" id="k-max5" size="5" maxlength="5">
<input type="text" id="l" size="5" maxlength="0">
<input type="text" id="m" size="5" maxlength="">
<input type="text" id="n" size="5" maxlength="invalid">
@@ -35,6 +35,8 @@ function visibleValueOf(id) {
}
var fancyX = "x" + String.fromCharCode(0x305) + String.fromCharCode(0x332);
+// u10000 is one character consisted of a surrogate pair.
+var u10000 = "\ud800\udc00";
debug("set value attribute that violates maxlength (with pasted value)");
document.getElementById("f").focus();
@@ -93,10 +95,20 @@ shouldBe("domValueOf('g')", "'12' + fancyX + '45'");
shouldBe("visibleValueOf('g')", "'12' + fancyX + '45'");
debug("pasting too much text");
-document.getElementById("k").focus();
+var target = document.getElementById("k-max5");
+target.focus();
document.execCommand("InsertHTML", false, "12x&#x305;&#x332;45");
-shouldBe("domValueOf('k')", "'12' + fancyX + '4'");
-shouldBe("visibleValueOf('k')", "'12' + fancyX + '4'");
+shouldBeEqualToString("domValueOf('k-max5')", "12" + fancyX);
+shouldBeEqualToString("visibleValueOf('k-max5')", "12" + fancyX);
+target.value = "";
+document.execCommand("InsertHTML", false, "123" + u10000);
+shouldBeEqualToString("domValueOf('k-max5')", "123" + u10000);
+shouldBeEqualToString("visibleValueOf('k-max5')", "123" + u10000);
+target.value = "";
+document.execCommand("InsertHTML", false, "1234" + u10000);
+shouldBeEqualToString("domValueOf('k-max5')", "1234");
+shouldBeEqualToString("visibleValueOf('k-max5')", "1234");
+
debug("pasting too much text with maxlength=0");
document.getElementById("l").focus();
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698