mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add spec, all specs were made to pass.
This commit is contained in:
parent
741c31bf2b
commit
37e3012009
4 changed files with 9 additions and 3 deletions
|
@ -112,7 +112,7 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
||||||
def params(button)
|
def params(button)
|
||||||
params = {}
|
params = {}
|
||||||
|
|
||||||
node.xpath(".//input[@type!='radio' and @type!='checkbox' and @type!='submit']").map do |input|
|
node.xpath(".//input[not(@type) or (@type!='radio' and @type!='checkbox' and @type!='submit')]").map do |input|
|
||||||
merge_param!(params, input['name'].to_s, input['value'].to_s)
|
merge_param!(params, input['name'].to_s, input['value'].to_s)
|
||||||
end
|
end
|
||||||
node.xpath(".//textarea").map do |textarea|
|
node.xpath(".//textarea").map do |textarea|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(value)
|
def set(value)
|
||||||
if tag_name == 'textarea' or (tag_name == 'input' and %w(text password hidden file).include?(type))
|
if tag_name == 'textarea' or (tag_name == 'input' and [nil, 'text', 'password', 'hidden', 'file'].include?(type))
|
||||||
node.clear
|
node.clear
|
||||||
node.send_keys(value.to_s)
|
node.send_keys(value.to_s)
|
||||||
elsif tag_name == 'input' and type == 'radio'
|
elsif tag_name == 'input' and type == 'radio'
|
||||||
|
|
|
@ -59,6 +59,12 @@ shared_examples_for "fill_in" do
|
||||||
extract_results(@session)['schmooo'].should == 'Schmooo is the game'
|
extract_results(@session)['schmooo'].should == 'Schmooo is the game'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should fill in a field without a type" do
|
||||||
|
@session.fill_in('Phone', :with => '+1 555 7022')
|
||||||
|
@session.click_button('awesome')
|
||||||
|
extract_results(@session)['phone'].should == '+1 555 7022'
|
||||||
|
end
|
||||||
|
|
||||||
it "should fill in a password field by name" do
|
it "should fill in a password field by name" do
|
||||||
@session.fill_in('form[password]', :with => 'supasikrit')
|
@session.fill_in('form[password]', :with => 'supasikrit')
|
||||||
@session.click_button('awesome')
|
@session.click_button('awesome')
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="form_phone">Phone</label>
|
<label for="form_phone">Phone</label>
|
||||||
<input type="text" name="form[phone]" value="+1 555 7021" id="form_phone"/>
|
<input name="form[phone]" value="+1 555 7021" id="form_phone"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in a new issue