Open
Description
Describe the bug
isVisible()
always returns false
for the details
element and its descendants when there is no open
attribute.
The summary
is visible in the browser even when details
is not open. details
is visible, but any other children than summary
are hidden when the attribute open
is not present.
To Reproduce
Given component DetailsComponent.vue
:
<template>
<details :open="open">
<summary>Details</summary>
<p>Something small enough to escape casual notice.</p>
</details>
</template>
<script setup lang="ts">
defineProps<{
open?: boolean;
}>();
</script>
Expected behavior
const wrapper = mount(DetailsComponent)
const details = wrapper.find('details');
expect(details.exists()).toEqual(true);
expect(details.isVisible()).toEqual(true); // debatable, because only `summary` inside `details` is visible
const summary = details.find('summary');
expect(summary.isVisible()).toEqual(true); // currently fails
expect(details.find('p').isVisible()).toEqual(false)
Additional context
A text node can also be a direct child of details
. That direct text node is hidden when the attribute open
is missing;
Used test-utils version 2.4.6