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

Merge branch 'master' of github.com:jnicklas/capybara

Conflicts:
	Gemfile.lock
This commit is contained in:
Jonas Nicklas 2010-10-06 21:12:11 +02:00
commit 81a686dd4b
5 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,3 @@
source :gemcutter
source :rubygems
gemspec

View file

@ -30,7 +30,7 @@ GEM
nokogiri (1.4.3.1-java)
weakling (>= 0.0.3)
rack (1.2.1)
rack-test (0.5.4)
rack-test (0.5.6)
rack (>= 1.0)
rake (0.8.7)
rspec (2.0.0.beta.22)

View file

@ -14,10 +14,10 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
case
when 'select' == tag_name && 'value' == attr_name
if native['multiple'] == 'multiple'
native.xpath(".//option[@selected='selected']").map { |option| option.content }
native.xpath(".//option[@selected='selected']").map { |option| option[:value] || option.content }
else
option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first
option.content if option
option[:value] || option.content if option
end
when 'input' == tag_name && 'checkbox' == type && 'checked' == attr_name
native[attr_name] == 'checked' ? true : false

View file

@ -13,6 +13,10 @@ shared_examples_for "select" do
@session.find_field('Title').value.should == 'Miss'
end
it "should return the value attribute rather than content if present" do
@session.find_field('Locale').value.should == 'en'
end
it "should select an option from a select box by id" do
@session.select("Finish", :from => 'form_locale')
@session.click_button('awesome')
@ -92,6 +96,10 @@ shared_examples_for "select" do
@session.click_button('awesome')
extract_results(@session)['languages'].should include('Ruby', 'Javascript')
end
it "should return value attribute rather than content if present" do
@session.find_field('Underwear').value.should include('thermal')
end
end
end
end

View file

@ -155,6 +155,7 @@
<option selected="selected">Briefs</option>
<option selected="selected">Commando</option>
<option selected="selected">Frenchman's Pantalons</option>
<option selected="selected" value="thermal">Long Johns</option>
</select>
</p>