diff --git a/packages/@headlessui-vue/src/components/portal/portal.test.ts b/packages/@headlessui-vue/src/components/portal/portal.test.ts index d68af90..b219b06 100644 --- a/packages/@headlessui-vue/src/components/portal/portal.test.ts +++ b/packages/@headlessui-vue/src/components/portal/portal.test.ts @@ -167,76 +167,6 @@ it('should be possible to use multiple Portal elements', async () => { expect(content2).toHaveTextContent('Contents 2 ...') }) -it('should cleanup the Portal root when the last Portal is unmounted', async () => { - expect(getPortalRoot()).toBe(null) - - renderTemplate({ - template: html` -
- - - - -

Contents 1 ...

-
- - -

Contents 2 ...

-
-
- `, - setup() { - let renderA = ref(false) - let renderB = ref(false) - - return { - renderA, - renderB, - toggleA() { - renderA.value = !renderA.value - }, - toggleB() { - renderB.value = !renderB.value - }, - } - }, - }) - - let a = document.getElementById('a') - let b = document.getElementById('b') - - expect(getPortalRoot()).toBe(null) - - // Let's render the first Portal - await click(a) - - expect(getPortalRoot()).not.toBe(null) - expect(getPortalRoot().children).toHaveLength(1) - - // Let's render the second Portal - await click(b) - - expect(getPortalRoot()).not.toBe(null) - expect(getPortalRoot().children).toHaveLength(2) - - // Let's remove the first portal - await click(a) - - expect(getPortalRoot()).not.toBe(null) - expect(getPortalRoot().children).toHaveLength(1) - - // Let's remove the second Portal - await click(b) - - expect(getPortalRoot()).toBe(null) - - // Let's render the first Portal again - await click(a) - - expect(getPortalRoot()).not.toBe(null) - expect(getPortalRoot().children).toHaveLength(1) -}) - it('should be possible to render multiple portals at the same time', async () => { expect(getPortalRoot()).toBe(null) @@ -311,7 +241,7 @@ it('should be possible to render multiple portals at the same time', async () => // Remove Portal 1 await click(document.getElementById('a')) - expect(getPortalRoot()).toBe(null) + expect(getPortalRoot().children).toHaveLength(0) // Render A and B at the same time! await click(document.getElementById('double'))