Closed
Description
The great cleanup
function destroys all the created components, but the targets are still around. What do you think about extending the cleanupAtContainer
function to remove the target
DOM nodes that were created as childen of body
, like react-testing-library
does?
export const render = (Component, options) => {
// ...
- mountedContainers.add(component)
+ mountedContainers.add({target, component})
// ...
}
- const cleanupAtContainer = container => {
+ const cleanupAtContainer = obj => {
+ const {target, component} = obj
- container.$destroy()
+ component.$destroy()
+ if (target.parentNode === document.body) {
+ document.body.removeChild(target)
+ }
- mountedContainers.delete(container)
+ mountedContainers.delete(obj)
}
Metadata
Metadata
Assignees
Labels
No labels