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̲̅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(); |