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

Check elements are visible when details is opened

This commit is contained in:
Thomas Walpole 2019-07-18 14:53:01 -07:00
parent 2e6871dcbf
commit 52331c8721
2 changed files with 8 additions and 4 deletions

View file

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

View file

@ -260,11 +260,14 @@ Capybara::SpecHelper.spec 'node' do
end end
it 'details non-summary descendants should be non-visible' do it 'details non-summary descendants should be non-visible' do
# expect(@session.find(:css, 'details ul')).not_to be_visible
@session.first(:css, 'details li').visible? @session.first(:css, 'details li').visible?
@session.all(:css, 'details > *:not(summary), details > *:not(summary) *', minimum: 2).each do |el| descendants = @session.all(:css, 'details > *:not(summary), details > *:not(summary) *', minimum: 2)
expect(el).not_to be_visible expect(descendants).not_to include(be_visible)
end end
it 'sees open details as visible', requires: [:js] do
@session.find(:css, 'details').click
expect(@session.all(:css, 'details *')).to all(be_visible)
end end
end end