Fix rack-test to ignore maxlength="", closes #396

This commit is contained in:
Jo Liss 2011-07-08 12:48:25 +02:00
parent f6c787e13a
commit c51a232bbc
2 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,10 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
native.remove_attribute('checked')
end
elsif tag_name == 'input'
if (type == 'text' || type == 'password') && self[:maxlength]
if (type == 'text' || type == 'password') && self[:maxlength] &&
!self[:maxlength].empty?
# Browser behavior for maxlength="0" is inconsistent, so we stick with
# Firefox, allowing no input
value = value[0...self[:maxlength].to_i]
end
native['value'] = value.to_s

View File

@ -50,7 +50,7 @@
<p>
<label>Street<br/>
<input type="text" name="form[street]" value="Sesame street 66"/>
<input type="text" maxlength="" name="form[street]" value="Sesame street 66"/>
</label>
</p>