Better implementation of attributes for celerity, closes #206

This commit is contained in:
Jonas Nicklas 2010-11-21 19:00:28 +01:00
parent 6fa8a5652c
commit b022ca9926
2 changed files with 3 additions and 6 deletions

View File

@ -5,11 +5,7 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
end
def [](name)
value = if name.to_sym == :class
native.class_name
else
native.send(name.to_sym)
end
value = native.attribute_value(name.to_sym)
return value if value and not value.to_s.empty?
end
@ -17,7 +13,7 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
if tag_name == "select" and native.multiple?
find(".//option[@selected]").map { |n| n.value || n.text }
else
self[:value]
native.value
end
end

View File

@ -42,6 +42,7 @@ shared_examples_for 'driver' do
it "should extract node attributes" do
@driver.find('//a')[0][:class].should == 'simple'
@driver.find('//a')[1][:id].should == 'foo'
@driver.find('//input')[0][:type].should == 'text'
end
it "should extract boolean node attributes" do