mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
hover implementation
This commit is contained in:
parent
0be88b9459
commit
15932d5a86
6 changed files with 24 additions and 5 deletions
|
@ -41,6 +41,10 @@ module Capybara
|
|||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def hover
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def drag_to(element)
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
|
|
@ -119,6 +119,14 @@ module Capybara
|
|||
synchronize { base.click }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# Hover on the Element
|
||||
#
|
||||
def hover
|
||||
synchronize { base.hover }
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# @return [String] The tag name of the element
|
||||
|
|
|
@ -57,6 +57,10 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
native.click
|
||||
end
|
||||
|
||||
def hover
|
||||
driver.browser.action.move_to(native).perform
|
||||
end
|
||||
|
||||
def drag_to(element)
|
||||
driver.browser.action.drag_and_drop(native, element.native).perform
|
||||
end
|
||||
|
|
|
@ -147,12 +147,13 @@ Capybara::SpecHelper.spec "node" do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#hover', :requires => [:hover], hover: true do
|
||||
describe '#hover', :requires => [:hover] do
|
||||
it "should allow hovering on an element" do
|
||||
pending "Selenium with firefox doesn't currently work with this (selenium with chrome does)" if @session.respond_to?(:mode) && @session.mode == :selenium && @session.driver.browser.browser == :firefox
|
||||
@session.visit('/with_hover')
|
||||
@session.find(:css,'.hidden_until_hover', visible: false).should_not be_visible
|
||||
@session.find(:css,'.hidden_until_hover', :visible => false).should_not be_visible
|
||||
@session.find(:css,'.wrapper').hover
|
||||
@session.find(:css, '.hidden_until_hover', visible: false).should be_visible
|
||||
@session.find(:css, '.hidden_until_hover', :visible => false).should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ Capybara::SpecHelper.run_specs TestClass.new, "DSL", :skip => [
|
|||
:screenshot,
|
||||
:frames,
|
||||
:windows,
|
||||
:server
|
||||
:server,
|
||||
:hover
|
||||
]
|
||||
|
||||
describe Capybara::DSL do
|
||||
|
|
|
@ -9,7 +9,8 @@ Capybara::SpecHelper.run_specs TestSessions::RackTest, "RackTest", :skip => [
|
|||
:screenshot,
|
||||
:frames,
|
||||
:windows,
|
||||
:server
|
||||
:server,
|
||||
:hover
|
||||
]
|
||||
|
||||
describe Capybara::Session do
|
||||
|
|
Loading…
Add table
Reference in a new issue