-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComponentWillUnmount ellipsis removal fails in test suites and other situations #128
Comments
I'll reopen this issue, since closing was done automatically, but no release has been published yet. |
@pablosichert i stumbled upon this same issue when using this component on a Storyshot/Jest test. The stacktrace has a bunch of JSDOM on it, so maybe it's due to a difference between that and real browsers. Deep unhelpful stacktrace
I'll probably pin my dependency to current Thanks for awesome library! it saved me quite some headaches fighting with |
Talked too soon. Couldn't pin the dependency to a github commit because it's not a release and so it does not include the |
I monkey-patching the Truncate library momentarily until a fix is released, to stop these error on the test suite. If it might help others, here's the terribly ugly code i used: if (typeof jest !== 'undefined') {
const originalWillUnmount = Truncate.prototype.componentWillUnmount
Truncate.prototype.componentWillUnmount = function () {
if (!this.elements.ellipsis) {
this.elements.ellipsis = { parentNode: { removeChild() {} } }
}
originalWillUnmount?.call(this)
}
} |
I am running into this as well. Any chance we can get a release that includes this fix? Many thanks for your work on this project 🙏 |
In
ComponentWillUnmount
,this.ellipsis
andthis.ellipsis.parentNode
need to be checked for before attempting removal so that it does not fail in test suites or other situations where it no longer exists. I will submit a PR for this simple fix shortly.The text was updated successfully, but these errors were encountered: