Fix implementation of #78

Brain fart when writing and testing the first attempt.
I can only actually reproduce the underlying issue in the REPL so I haven't confirmed that this fixes it.
This commit is contained in:
Ryan Gossiaux
2022-03-06 23:57:32 -08:00
parent b2a288c874
commit 39a8b57c36
3 changed files with 10 additions and 34 deletions

View File

@@ -334,26 +334,3 @@ it('should cleanup the Portal properly when Svelte would not detach it', async (
expect(getPortalRoot()).not.toBe(null)
expect(getPortalRoot().childNodes).toHaveLength(1)
})
it('should move the Portal last during initial render', async () => {
expect(getPortalRoot()).toBe(null)
// We need to use a custom target because of the implementation of
// render() in the testing library
render(svelte`
<script>
let target = document.body.firstChild;
</script>
<PortalGroup {target}>
<Portal>Portal</Portal>
</PortalGroup>
<main>Main</main>
`)
await tick();
expect(document.body.innerHTML).toMatchInlineSnapshot(
`"<div> <main>Main</main><div>Portal</div></div>"`
)
})