Fix .value on a textarea to give you the content for the rack driver.

This commit is contained in:
Rob Holland 2010-05-14 09:52:37 +01:00
parent 8ff36c4933
commit 31d831328c
3 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,13 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
end
end
def value
if tag_name == 'textarea'
node.content
else
super
end
end
def set(value)
if tag_name == 'input' and type == 'radio'

View File

@ -55,6 +55,10 @@ shared_examples_for 'driver' do
@driver.find('//input[@id="checked_field"]')[0][:checked].should be_true
end
it "should allow retrieval of the value" do
@driver.find('//textarea').first.value.should == 'banana'
end
it "should allow assignment of field value" do
@driver.find('//input').first.value.should == 'monkey'
@driver.find('//input').first.set('gorilla')

View File

@ -20,6 +20,7 @@
<p>
<input type="text" id="test_field" value="monkey"/>
<textarea>banana</textarea>
<a href="/redirect_back">BackToMyself</a>
<a title="twas a fine link" href="/redirect">A link came first</a>
<a title="a fine link" href="/with_simple_html">A link</a>