1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Spec boolean attributes

This commit is contained in:
Jonas Nicklas 2010-01-30 20:43:56 +01:00
parent b4de9b7015
commit 95a63f8d30
3 changed files with 6 additions and 1 deletions

View file

@ -10,7 +10,7 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
else
node.send(name.to_sym)
end
return value if value and not value.empty?
return value if value and not value.to_s.empty?
end
def set(value)

View file

@ -47,6 +47,10 @@ shared_examples_for 'driver' do
@driver.find('//a')[1][:rel].should be_nil
end
it "should extract boolean node attributes" do
@driver.find('//input[@id="checked_field"]')[0][:checked].should be_true
end
it "should allow assignment of field value" do
@driver.find('//input').first.value.should == 'monkey'
@driver.find('//input').first.set('gorilla')

View file

@ -26,6 +26,7 @@
<a href="/with_simple_html#anchor">Anchor on different page</a>
<a href="/with_html#anchor">Anchor on same page</a>
<input type="text" value="" id="test_field">
<input type="text" checked="checked" id="checked_field">
<a href="/redirect"><img src="http://www.foobar.sun/dummy_image.jpg" width="20" height="20" alt="very fine image" /></a>
<a href="/with_simple_html"><img src="http://www.foobar.sun/dummy_image.jpg" width="20" height="20" alt="fine image" /></a>
</p>