Fix .value on a textarea to give you the content for the rack driver.
This commit is contained in:
parent
8ff36c4933
commit
31d831328c
|
@ -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'
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue