Revert "added click_element with specs (only works in webdriver so far)"

I think I changed my mind about this, I think this method clutters the API

This reverts commit 7b8e6a640d.
This commit is contained in:
Jonas Nicklas 2009-12-17 18:22:12 +01:00
parent 026299f7bb
commit 6204142a8c
8 changed files with 4 additions and 30 deletions

View File

@ -50,7 +50,7 @@ module Capybara
:visit, :current_url, :body, :click_link, :click_button, :drag, :fill_in, :choose, :has_xpath?, :has_css?,
:check, :uncheck, :attach_file, :select, :has_content?, :within, :within_fieldset,
:within_table, :save_and_open_page, :find, :find_field, :find_link, :find_button,
:field_labeled, :all, :wait_for, :evaluate_script, :click, :click_element
:field_labeled, :all, :wait_for, :evaluate_script, :click
]
SESSION_METHODS.each do |method|
class_eval <<-RUBY, __FILE__, __LINE__+1

View File

@ -47,12 +47,6 @@ module Capybara
button.click
end
def click_element(locator)
element = wait_for(XPath.element(locator))
raise Capybara::ElementNotFound, "the element '#{locator}' could not be found" unless element
element.click
end
def drag(source_locator, target_locator)
source = wait_for(source_locator)
raise Capybara::ElementNotFound, "drag source '#{source_locator}' not found on page" unless source

View File

@ -34,10 +34,6 @@ module Capybara
def fillable_field(locator)
text_field(locator).password_field(locator).text_area(locator)
end
def element(locator)
append("//div[@id=#{s(locator)}]")
end
def content(locator)
append("/descendant-or-self::*[contains(.,#{s(locator)})]")

View File

@ -1,11 +0,0 @@
module ClickElementSpec
shared_examples_for "click_element" do
describe '#click_element' do
it "should click on a element" do
@session.visit('/with_js')
@session.click_element('fool_to_cry')
@session.body.should include('<div id="fool_to_cry">daddy your a fool to cry</div>')
end
end
end
end

View File

@ -40,7 +40,7 @@ shared_examples_for "session" do
it_should_behave_like "select"
it_should_behave_like "uncheck"
it_should_behave_like "wait_for"
it_should_behave_like "within"
it_should_behave_like "within"
end

View File

@ -1,4 +1,5 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'nokogiri'
shared_examples_for "session with javascript support" do
@ -48,7 +49,5 @@ shared_examples_for "session with javascript support" do
@session.fill_in('new_field', :with => 'Testing...')
end
end
it_should_behave_like "click_element"
end

View File

@ -1,4 +1,5 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'nokogiri'
shared_examples_for "session without javascript support" do

View File

@ -24,9 +24,6 @@
}, 500);
return false;
});
$("#fool_to_cry").click(function(){
$(this).html('daddy your a fool to cry')
});
});
//]]>
</script>
@ -35,8 +32,6 @@
<body id="with_js">
<h1>FooBar</h1>
<div id="fool_to_cry">and she said</div>
<p id="change">This is text</p>
<div id="drag">
<p>This is a draggable element.</p>