Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,10 @@ export default class Wrapper implements BaseWrapper {
let element = this.element
while (element) {
if (
element.style &&
(element.style.visibility === 'hidden' ||
element.style.display === 'none')
element.hidden ||
(element.style &&
(element.style.visibility === 'hidden' ||
element.style.display === 'none'))
) {
return false
}
Expand Down
9 changes: 9 additions & 0 deletions test/specs/wrapper/isVisible.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ describeWithShallowAndMount('isVisible', mountingMethod => {
expect(element.isVisible()).to.equal(false)
})

it('returns false if element has hidden attribute', () => {
const compiled = compileToFunctions(
'<div><div><span class="visible" hidden></span></div></div>'
)
const wrapper = mountingMethod(compiled)
const element = wrapper.find('.visible')
expect(element.isVisible()).to.equal(false)
})

it('returns true if element has v-show true', async () => {
const wrapper = mountingMethod(ComponentWithVShow)
wrapper.vm.$set(wrapper.vm, 'ready', true)
Expand Down