Index: third_party/WebKit/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html |
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html |
index b39c788043c72edfecdcecf782b93921c24897c1..b90b2aba6c3a69b5f4b4fb5b2dea9145004d6098 100644 |
--- a/third_party/WebKit/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html |
+++ b/third_party/WebKit/LayoutTests/fast/css/invalidation/valid-invalid-pseudo.html |
@@ -5,7 +5,9 @@ input { background-color: transparent } |
#inputValid:valid, |
#inputInvalid:invalid, |
#formValid:valid, |
-#formInvalid:invalid { |
+#formInvalid:invalid, |
+#maxlengthInvalid:invalid, |
+#minlengthInvalid:invalid { |
background-color: green |
} |
@@ -42,6 +44,16 @@ input + div { |
<div></div> |
<div></div> |
</div> |
+<input id="maxlengthInvalid" type="text"></input> |
+<div> |
+ <div></div> |
+ <div></div> |
+</div> |
+<input id="minlengthInvalid" type="text"></input> |
+<div> |
+ <div></div> |
+ <div></div> |
+</div> |
<script> |
description("Use descendant invalidation sets for :valid and :invalid pseudo classes.") |
@@ -77,4 +89,27 @@ if (window.internals) |
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2"); |
shouldBe("getComputedStyle(formInvalid, '').backgroundColor", "green"); |
+// Make sure the value is user input, otherwise setting maxlength/minlength |
+// won't cause a validation. |
+if (window.eventSender) { |
+ maxlengthInvalid.focus(); |
+ eventSender.keyDown("x"); |
+ eventSender.keyDown("x"); |
+ minlengthInvalid.focus(); |
+ eventSender.keyDown("x"); |
+} |
+ |
+shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "transparent"); |
+document.body.offsetTop; // Force recalc. |
+maxlengthInvalid.setAttribute("maxlength", "1"); |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
+shouldBe("getComputedStyle(maxlengthInvalid, '').backgroundColor", "green"); |
+ |
+shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "transparent"); |
+document.body.offsetTop; // Force recalc. |
+minlengthInvalid.setAttribute("minlength", "2"); |
+if (window.internals) |
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1"); |
+shouldBe("getComputedStyle(minlengthInvalid, '').backgroundColor", "green"); |
</script> |