From 88d58ce991c0a30d2d445c0af4751b3920c9b370 Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer and Tim Pope Date: Wed, 16 Jun 2010 15:06:20 -0500 Subject: [PATCH] In Selenium, support "" etc. --- lib/capybara/driver/selenium_driver.rb | 8 ++++---- lib/capybara/spec/session/fill_in_spec.rb | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/capybara/driver/selenium_driver.rb b/lib/capybara/driver/selenium_driver.rb index b24754b61..14b51a952 100644 --- a/lib/capybara/driver/selenium_driver.rb +++ b/lib/capybara/driver/selenium_driver.rb @@ -25,13 +25,13 @@ def value end def set(value) - if tag_name == 'textarea' or (tag_name == 'input' and %w(text password hidden file).include?(type)) - node.clear - node.send_keys(value.to_s) - elsif tag_name == 'input' and type == 'radio' + if tag_name == 'input' and type == 'radio' node.click elsif tag_name == 'input' and type == 'checkbox' node.click if node.attribute('checked') != value + elsif tag_name == 'textarea' or tag_name == 'input' + node.clear + node.send_keys(value.to_s) end end diff --git a/lib/capybara/spec/session/fill_in_spec.rb b/lib/capybara/spec/session/fill_in_spec.rb index b19746468..65608cc72 100644 --- a/lib/capybara/spec/session/fill_in_spec.rb +++ b/lib/capybara/spec/session/fill_in_spec.rb @@ -53,7 +53,6 @@ end it "should fill in a field with a custom type" do - pending "selenium doesn't seem to find custom fields" if @session.mode == :selenium @session.fill_in('Schmooo', :with => 'Schmooo is the game') @session.click_button('awesome') extract_results(@session)['schmooo'].should == 'Schmooo is the game'