1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge pull request #1136 from twalpole/hidden

support html5 hidden attribute that selenium now supports
This commit is contained in:
Jonas Nicklas 2013-08-26 05:58:52 -07:00
commit 04c31d5e9a
3 changed files with 8 additions and 1 deletions

View file

@ -95,7 +95,7 @@ module Capybara
# @return [Boolean] Whether the element is visible
#
def visible?
native.xpath("./ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or name()='script' or name()='head']").size == 0
native.xpath("./ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or @hidden or name()='script' or name()='head']").size == 0
end
##

View file

@ -130,6 +130,8 @@ Capybara::SpecHelper.spec "node" do
@session.find('//div[@id="hidden"]').should_not be_visible
@session.find('//div[@id="hidden_via_ancestor"]').should_not be_visible
@session.find('//div[@id="hidden_attr"]').should_not be_visible
@session.find('//a[@id="hidden_attr_via_ancestor"]').should_not be_visible
end
end

View file

@ -66,6 +66,11 @@ banana</textarea>
<a href="/with_simple_html" title="hidden link" class="simple">hidden link</a>
</div>
<div id="hidden_attr" hidden="hidden">
<a id="hidden_attr_via_ancestor">hidden attribute ancestor link</a>
</div>
<div id="hidden-text">
Some of this text is <em style="display:none">hidden!</em>
</div>