Index: LayoutTests/fast/forms/textarea-minlength.html |
diff --git a/LayoutTests/fast/forms/textarea-minlength.html b/LayoutTests/fast/forms/textarea-minlength.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..45146638f9d52def8b751fa276bb6fc91afe9fd9 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/textarea-minlength.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<div id="console"></div> |
+<script> |
+description('Tests for HTMLTextAreaElement.minLength behaviors.'); |
+ |
+var textArea = document.createElement('textarea'); |
+document.body.appendChild(textArea); |
+ |
+// No minlength attribute |
+shouldBe('textArea.minLength', '-1'); |
+ |
+// Invalid minlength attributes |
+textArea.setAttribute('minlength', '-3'); |
+shouldBe('textArea.minLength', '-1'); |
+textArea.setAttribute('minlength', 'xyz'); |
+shouldBe('textArea.minLength', '-1'); |
+ |
+// Valid minlength attributes |
+textArea.setAttribute('minlength', '1'); |
+shouldBe('textArea.minLength', '1'); |
+textArea.setAttribute('minlength', '256'); |
+shouldBe('textArea.minLength', '256'); |
+ |
+// Set values to .minLength |
+textArea.minLength = 6; |
+shouldBe('textArea.getAttribute("minlength")', '"6"'); |
+ |
+shouldThrow('textArea.minLength = -1', '"IndexSizeError: Failed to set the \'minLength\' property on \'HTMLTextAreaElement\': The value provided (-1) is not positive or 0."'); |
+shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed |
+textArea.maxLength = 10; |
+shouldThrow('textArea.minLength = 11', '"IndexSizeError: Failed to set the \'minLength\' property on \'HTMLTextAreaElement\': The minLength provided (11) is greater than the maximum bound (10)."'); |
+shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed |
+shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"'); |
+ |
+textArea.minLength = null; |
+shouldBe('textArea.minLength', '0'); |
+shouldBe('textArea.getAttribute("minlength")', '"0"'); |
+ |
+</script> |
+</body> |
+</html> |