-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Describe the bug
When using p-date-picker (and likely other components that use @primeuix/motion for animations) in a Jest + jsdom 28 environment, the following error is thrown:
SyntaxError: 'div.min-w-1,,, .p-datepicker-input-icon-container' is not a valid selector
@primeuix/motion builds a CSS selector by reading the class list of the host element. When Tailwind v4 utility classes (e.g. min-w-1) are present alongside empty segments, the resulting selector contains ,, which is invalid CSS.
This was silently accepted by jsdom 27 (which used nwsapi) but jsdom 28 switched to @asamuzakjp/dom-selector which is stricter and throws on invalid selectors.
To Reproduce
- Use
p-date-pickerwith[fluid]="true"and[showIcon]="true"inside a wrapper that has Tailwind v4 classes - Use Jest with
jest-environment-jsdom>= 28 - Interact with the datepicker in a test (e.g. click a button that triggers change detection after the datepicker renders)
Expected behavior
@primeuix/motion should filter out empty segments before joining class names into a CSS selector/
Environment
- PrimeNG version: 21.1.2
- Angular version: 21
- @primeuix/motion version: 0.0.10
- jsdom version: 28.1.0
- Tailwind version: 4
- Testing: Jest + @testing-library/angular + setupZonelessTestEnv
Workaround
Pinning jsdom to 27.3.0 via npm overrides in package.json restores the previous behavior.