test for hover

This commit is contained in:
Thomas Walpole 2013-02-25 09:56:23 -08:00
parent 6e586bc9b3
commit 0be88b9459
2 changed files with 26 additions and 0 deletions

View File

@ -146,6 +146,15 @@ Capybara::SpecHelper.spec "node" do
@session.find('//div[contains(., "Dropped!")]').should_not be_nil
end
end
describe '#hover', :requires => [:hover], hover: true do
it "should allow hovering on an element" do
@session.visit('/with_hover')
@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
end
end
describe '#reload', :requires => [:js] do
context "without automatic reload" do

View File

@ -0,0 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>with_hover</title>
</head>
<body id="with_hover">
<style type="text/css">
.hidden_until_hover {display: none;}
.wrapper:hover .hidden_until_hover { display: block }
</style>
<div class="wrapper">
Some text here so the wrapper has size
<div class="hidden_until_hover">Here I am</div>
</div>
</body>
</html>