-
Notifications
You must be signed in to change notification settings - Fork 113
Open
@obrejla
Description
Describe the bug A clear and concise description of what the bug is.
This is regression from testing-library/vue v6.6.1. When there is an element inside the Teleport component which has v-if attribute, then such element is not rendered in tests, when Teleport is stubbed. It used to work in v6.6.1 with testing-library/dom v8.19.0
To Reproduce Steps to reproduce the behavior:
Simple component example
<template> <Teleport to="#foo"> <div v-if="isVisible" class="my-div">xxx</div> </Teleport> </template> <script setup lang="ts"> import { onMounted, ref } from "vue"; const isVisible = ref(false); onMounted(() => { isVisible.value = true; }); </script>
With simple test example
import MyTest from "./MyTest.vue"; import { render, waitFor } from "@testing-library/vue"; describe("MyTest Tests", () => { it("should pass", async () => { const { container } = render(MyTest, { global: { stubs: { teleport: true, }, }, }); await waitFor(() => expect(container.querySelector(".my-div")).toBeInTheDocument()); }); });
Expected behavior
div with class my-div is properly rendered and test passes
Related information:
@testing-library/vueversion: 7.0.0@testing-library/domversion: 9.2.0Vueversion: 3.2.47nodeversion: 16.13.0yarnversion: 1.22.18