Support maxlength

This commit is contained in:
Matthew Mongeau 2011-07-22 15:21:36 -04:00
parent c621e651c9
commit 983b556fa8
1 changed files with 2 additions and 1 deletions

View File

@ -101,7 +101,8 @@ Capybara = {
if (type == "text" || type == "textarea" || type == "password") {
this.trigger(index, "focus");
node.value = "";
for(var strindex = 0; strindex < value.length; strindex++) {
var length = this.attribute(index, "maxlength") || value.length;
for(var strindex = 0; strindex < length; strindex++) {
node.value += value[strindex];
this.trigger(index, "keydown");
this.keypress(index, false, false, false, false, 0, value[strindex]);