Skip to content

#2168: Added unit tests to check proper component unmounting#2195

Merged
JoviDeCroock merged 4 commits into
preactjs:masterfrom
timon-witt:#2168-unmount-children
Jan 17, 2020
Merged

#2168: Added unit tests to check proper component unmounting#2195
JoviDeCroock merged 4 commits into
preactjs:masterfrom
timon-witt:#2168-unmount-children

Conversation

@timon-witt

Copy link
Copy Markdown
Contributor

I added two tests that show the bug: #2168

@coveralls

coveralls commented Dec 19, 2019

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 97.747% when pulling 44c3581 on timon-witt:#2168-unmount-children into 25fee1c on preactjs:master.

Comment thread test/browser/render.test.js Outdated
}
}

// The only difference to the previous test is the extra div here

@JoviDeCroock JoviDeCroock Dec 19, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but this <div> is not part of your vnode tree since you start underneath and then target it with newScratch.firstElementChild did this work with Preact 8? This isn't supported in Preact X atleast since this falls outside your render root.

<scratch>
  <div> <-- you start replacing node here
    <div id="child"> <-- your root starts here
</scratch>

^ this is intended

@JoviDeCroock

Copy link
Copy Markdown
Member

I don't mind merging in the first test, the second has been discussed on your issue right? Do you think we could do more to help out in this case?

@timon-witt

Copy link
Copy Markdown
Contributor Author

Yes, the issue has been discussed and there is a reasonable workaround for now. Keeping the first test would still be great like you said. Thank's for the support!

@JoviDeCroock JoviDeCroock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, more tests prevents us from accidentally shipping regressions!

@JoviDeCroock JoviDeCroock merged commit 6771b23 into preactjs:master Jan 17, 2020
@pika-ci

pika-ci Bot commented Jan 17, 2020

Copy link
Copy Markdown

🚀 This PR has been merged! Once a new release is created, any changes will become available on npm. Until then, you can load and install it directly from the Pika CDN:

npm install https://cdn.pika.dev/preact/master

porfirioribeiro pushed a commit to porfirioribeiro/preact that referenced this pull request Feb 3, 2020
…reactjs#2195)

* preactjs#2168: Added unit tests to check proper component unmounting

* preactjs#2168: Remove test onlies

* remove the second test (invalid)

Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants