template elements should not be considered visible

This commit is contained in:
Thomas Walpole 2019-05-17 09:34:00 -07:00
parent 31b74c52d3
commit 8faa557c45
3 changed files with 6 additions and 0 deletions

View File

@ -102,6 +102,7 @@ module Capybara
#
def visible?(check_ancestors = true)
return false if (tag_name == 'input') && (native[:type] == 'hidden')
return false if tag_name == 'template'
if check_ancestors
!find_xpath(VISIBILITY_XPATH)

View File

@ -242,6 +242,7 @@ Capybara::SpecHelper.spec 'node' do
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
expect(@session.find('//template')).not_to be_visible
end
it 'should be boolean' do

View File

@ -178,5 +178,9 @@ banana</textarea>
&#x20;&#x1680;&#x2000;&#x2001;&#x2002; &#x2003;&#x2004;&nbsp;&#x2005; &#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x202F;&#x205F;&#x3000;
</div>
<template id="template">
<input />
</template>
<a href="/download.csv" download>Download Me</a>
<a href="/download.csv" download="other.csv">Download Other</a>