diff --git a/lib/capybara/driver/webkit/node.rb b/lib/capybara/driver/webkit/node.rb index ddfcf67..bbb9a3c 100644 --- a/lib/capybara/driver/webkit/node.rb +++ b/lib/capybara/driver/webkit/node.rb @@ -1,9 +1,5 @@ class Capybara::Driver::Webkit class Node < Capybara::Driver::Node - - class ElementNotDisplayedError < StandardError - end - NBSP = "\xC2\xA0" NBSP.force_encoding("UTF-8") if NBSP.respond_to?(:force_encoding) @@ -33,7 +29,6 @@ class Capybara::Driver::Webkit end def select_option - check_visibility(self) invoke "selectOption" end @@ -47,13 +42,10 @@ class Capybara::Driver::Webkit end def click - check_visibility(self) invoke "click" end def drag_to(element) - check_visibility(self) - check_visibility(element) invoke 'dragTo', element.native end @@ -122,9 +114,5 @@ class Capybara::Driver::Webkit def multiple_select? self.tag_name == "select" && self["multiple"] == "multiple" end - - def check_visibility(element) - raise(ElementNotDisplayedError, "This element is not visible so it may not be interacted with") unless element.visible? - end end end diff --git a/spec/driver_spec.rb b/spec/driver_spec.rb index dc849b5..8b27c60 100644 --- a/spec/driver_spec.rb +++ b/spec/driver_spec.rb @@ -713,13 +713,10 @@ describe Capybara::Driver::Webkit do
Change me
Push me
Release me
- -
Next - HTML [200, @@ -750,7 +746,7 @@ describe Capybara::Driver::Webkit do end end - it "clicks a visible element" do + it "clicks an element" do subject.find("//a").first.click subject.current_url =~ %r{/next$} end @@ -782,39 +778,6 @@ describe Capybara::Driver::Webkit do subject.find("//*[@class='triggered']").size.should == 1 end - - context "raises error when" do - it "tries to click an invisible element" do - expect { - subject.find("//*[@id='hidden']").first.click - }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError) - end - - it "tries to drag an invisible element to a visible one" do - draggable = subject.find("//*[@id='invisible-mousedown']").first - container = subject.find("//*[@id='mouseup']").first - - expect { - draggable.drag_to(container) - }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError) - end - - it "tries to drag a visible element to an invisible one" do - draggable = subject.find("//*[@id='mousedown']").first - container = subject.find("//*[@id='invisible-mouseup']").first - - expect { - draggable.drag_to(container) - }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError) - end - - it "tries to select an invisible option" do - option = subject.find("//option[@id='invisible-option']").first - expect { - option.select_option - }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError) - end - end end context "nesting app" do