Skip to content
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

chore: add ElementInternals shim #10782

Merged
merged 4 commits into from
Feb 7, 2025
Merged

chore: add ElementInternals shim #10782

merged 4 commits into from
Feb 7, 2025

Conversation

ilhan007
Copy link
Member

@ilhan007 ilhan007 commented Feb 5, 2025

With the introduce of the ButtonBadge, some users of jsdom complained of test failures because of the code below, caused by missing ElementInternals API in the jsdom env. As it's likely to need this for the SSR topic, we now provide a shim for attachInternals method, returning a shim for the ElementInternals class.

if (needsOverflowVisible) {
	this._internals.states.add("has-overlay-badge"); // fails in jsdom
} else {
	this._internals.states.delete("has-overlay-badge"); // fails in jsdom
}

@ilhan007 ilhan007 merged commit 60fca15 into main Feb 7, 2025
12 checks passed
@ilhan007 ilhan007 deleted the chore-elementInternals-shim branch February 7, 2025 08:26
ilhan007 added a commit that referenced this pull request Feb 7, 2025
With the introduce of the ButtonBadge, some users of jsdom complained of test failures because of the code below, caused by missing ElementInternals API in the jsdom env. As it's likely to need this for the SSR topic,  we now provide a shim for `attachInternals` method, returning a shim for the ElementInternals class.

```ts
if (needsOverflowVisible) {
	this._internals.states.add("has-overlay-badge"); // fails in jsdom
} else {
	this._internals.states.delete("has-overlay-badge"); // fails in jsdom
}
```
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.

2 participants