Permalink
Browse files

Support maxlength

  • Loading branch information...
1 parent c621e65 commit 983b556fa83c10a4de903bee56dd53ba5075eb27 @halogenandtoast halogenandtoast committed Jul 22, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/capybara.js
View
@@ -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]);

0 comments on commit 983b556

Please sign in to comment.