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:
commit
81a686dd4b
5 changed files with 13 additions and 4 deletions
2
Gemfile
2
Gemfile
|
@ -1,3 +1,3 @@
|
|||
source :gemcutter
|
||||
source :rubygems
|
||||
|
||||
gemspec
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue