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
|
gemspec
|
||||||
|
|
|
@ -30,7 +30,7 @@ GEM
|
||||||
nokogiri (1.4.3.1-java)
|
nokogiri (1.4.3.1-java)
|
||||||
weakling (>= 0.0.3)
|
weakling (>= 0.0.3)
|
||||||
rack (1.2.1)
|
rack (1.2.1)
|
||||||
rack-test (0.5.4)
|
rack-test (0.5.6)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rake (0.8.7)
|
rake (0.8.7)
|
||||||
rspec (2.0.0.beta.22)
|
rspec (2.0.0.beta.22)
|
||||||
|
|
|
@ -14,10 +14,10 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
||||||
case
|
case
|
||||||
when 'select' == tag_name && 'value' == attr_name
|
when 'select' == tag_name && 'value' == attr_name
|
||||||
if native['multiple'] == 'multiple'
|
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
|
else
|
||||||
option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first
|
option = native.xpath(".//option[@selected='selected']").first || native.xpath(".//option").first
|
||||||
option.content if option
|
option[:value] || option.content if option
|
||||||
end
|
end
|
||||||
when 'input' == tag_name && 'checkbox' == type && 'checked' == attr_name
|
when 'input' == tag_name && 'checkbox' == type && 'checked' == attr_name
|
||||||
native[attr_name] == 'checked' ? true : false
|
native[attr_name] == 'checked' ? true : false
|
||||||
|
|
|
@ -13,6 +13,10 @@ shared_examples_for "select" do
|
||||||
@session.find_field('Title').value.should == 'Miss'
|
@session.find_field('Title').value.should == 'Miss'
|
||||||
end
|
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
|
it "should select an option from a select box by id" do
|
||||||
@session.select("Finish", :from => 'form_locale')
|
@session.select("Finish", :from => 'form_locale')
|
||||||
@session.click_button('awesome')
|
@session.click_button('awesome')
|
||||||
|
@ -92,6 +96,10 @@ shared_examples_for "select" do
|
||||||
@session.click_button('awesome')
|
@session.click_button('awesome')
|
||||||
extract_results(@session)['languages'].should include('Ruby', 'Javascript')
|
extract_results(@session)['languages'].should include('Ruby', 'Javascript')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should return value attribute rather than content if present" do
|
||||||
|
@session.find_field('Underwear').value.should include('thermal')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
<option selected="selected">Briefs</option>
|
<option selected="selected">Briefs</option>
|
||||||
<option selected="selected">Commando</option>
|
<option selected="selected">Commando</option>
|
||||||
<option selected="selected">Frenchman's Pantalons</option>
|
<option selected="selected">Frenchman's Pantalons</option>
|
||||||
|
<option selected="selected" value="thermal">Long Johns</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue