inputs of type hidden should not be visisble
This commit is contained in:
parent
1abfda0ac1
commit
1ed280591f
|
@ -99,6 +99,8 @@ module Capybara
|
|||
# @return [Boolean] Whether the element is visible
|
||||
#
|
||||
def visible?(check_ancestors = true)
|
||||
return false if (tag_name == 'input') && (native[:type]=="hidden")
|
||||
|
||||
if check_ancestors
|
||||
#check size because oldest supported nokogiri doesnt support xpath boolean() function
|
||||
native.xpath("./ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or @hidden or name()='script' or name()='head']").size() == 0
|
||||
|
|
|
@ -177,6 +177,7 @@ Capybara::SpecHelper.spec "node" do
|
|||
expect(@session.find('//div[@id="hidden_via_ancestor"]')).not_to be_visible
|
||||
expect(@session.find('//div[@id="hidden_attr"]')).not_to be_visible
|
||||
expect(@session.find('//a[@id="hidden_attr_via_ancestor"]')).not_to be_visible
|
||||
expect(@session.find('//input[@id="hidden_input"]')).not_to be_visible
|
||||
end
|
||||
|
||||
it "should be boolean" do
|
||||
|
|
|
@ -109,6 +109,7 @@ banana</textarea>
|
|||
</div>
|
||||
|
||||
<input type="text" disabled="disabled" name="disabled_text" value="This is disabled"/>
|
||||
<input type="hidden" id="hidden_input" name="hidden_input" value="This is a hidden input"/>
|
||||
|
||||
<div>
|
||||
<a id="link_placeholder">No href</a>
|
||||
|
|
Loading…
Reference in New Issue