Skip to content

Commit

Permalink
Merge remote branch 'ursm/input-without-type'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/capybara/driver/rack_test_driver.rb
	lib/capybara/driver/selenium_driver.rb
  • Loading branch information
jnicklas committed Jun 19, 2010
2 parents bfeaef4 + 37e3012 commit a94f994
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/capybara/driver/rack_test_driver.rb
Expand Up @@ -112,7 +112,7 @@ class Form < Node
def params(button)
params = {}

node.xpath(".//input[@type!='radio' and @type!='checkbox' and @type!='submit' and @type!='image']").map do |input|
node.xpath(".//input[not(@type) or (@type!='radio' and @type!='checkbox' and @type!='submit' and @type!='image')]").map do |input|
merge_param!(params, input['name'].to_s, input['value'].to_s)
end
node.xpath(".//textarea").map do |textarea|
Expand Down
6 changes: 6 additions & 0 deletions lib/capybara/spec/session/fill_in_spec.rb
Expand Up @@ -58,6 +58,12 @@
extract_results(@session)['schmooo'].should == 'Schmooo is the game'
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
@session.fill_in('form[password]', :with => 'supasikrit')
@session.click_button('awesome')
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/spec/views/form.erb
Expand Up @@ -46,7 +46,7 @@

<p>
<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>
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/xpath.rb
Expand Up @@ -111,7 +111,7 @@ def button(locator)

def text_field(locator, options={})
options = options.merge(:value => options[:with]) if options.has_key?(:with)
add_field(locator, "//input[@type!='radio' and @type!='checkbox' and @type!='hidden']", options)
add_field(locator, "//input[not(@type) or (@type!='radio' and @type!='checkbox' and @type!='hidden')]", options)
end

def text_area(locator, options={})
Expand Down

0 comments on commit a94f994

Please sign in to comment.