Skip to content

isVisible doesn't check visibility due to CSS classes #1456

Closed
@bbones

Description

@bbones

What problem does this feature solve?

Making test for components like this

<template>
    <div>
        <h1>Header</h1>
        <button class="hidden">Test</button>
    </div>
</template>

<script>
  export default {
    name: "Foo"
  }
</script>

<style scoped>
    .hidden {
        display: none;
    }
</style>
describe('Foo.vue', () => {
  test('Button', () => {
    const wrapper = shallowMount(Foo, {});
    console.log(wrapper.isVisible());
    const but = wrapper.find('button');
    console.log(window.getComputedStyle(but.element).display);
    console.log(but.isVisible());
  });
});

What does the proposed API look like?

Call of isVisible will be the same as before

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions