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

DOMException: Invalid selector, when parsing tailwindcss #939

Closed
rinux55 opened this issue May 26, 2023 · 4 comments · Fixed by #943
Closed

DOMException: Invalid selector, when parsing tailwindcss #939

rinux55 opened this issue May 26, 2023 · 4 comments · Fixed by #943
Labels
bug Something isn't working

Comments

@rinux55
Copy link

rinux55 commented May 26, 2023

I'm testing a nuxt 3 application with vite and nuxt-vitest, which uses happy-dom. When installing the @nuxtjs/tailwindcss nuxt module, I'm getting the following error when asserting expect().toBeVisible():

DOMException: Invalid selector: "::-webkit-inner-spin-button,::-webkit-outer-spin-button"
 ❯ Function.getSelectorGroups ../../../node_modules/happy-dom/src/query-selector/SelectorParser.ts:186:10
 ❯ Function.match ../../../node_modules/happy-dom/src/query-selector/QuerySelector.ts:119:38
 ❯ CSSStyleDeclarationElementStyle.parseCSSRules ../../../node_modules/happy-dom/src/css/declaration/element-style/CSSStyleDeclarationElementStyle.ts:274:42
 ❯ CSSStyleDeclarationElementStyle.getComputedElementStyle ../../../node_modules/happy-dom/src/css/declaration/element-style/CSSStyleDeclarationElementStyle.ts:128:12
 ❯ CSSStyleDeclarationElementStyle.getElementStyle ../../../node_modules/happy-dom/src/css/declaration/element-style/CSSStyleDeclarationElementStyle.ts:63:16
 ❯ CSSStyleDeclaration.getPropertyValue ../../../node_modules/happy-dom/src/css/declaration/AbstractCSSStyleDeclaration.ts:193:37
 ❯ CSSStyleDeclaration.get visibility [as visibility] ../../../node_modules/happy-dom/src/css/declaration/CSSStyleDeclaration.ts:4625:15
 ❯ isInaccessible ../../../node_modules/@testing-library/dom/dist/role-helpers.js:67:39
 ❯ ../../../node_modules/@testing-library/dom/dist/queries/role.js:195:63

I've narrowed it down to the @nuxtjs/tailwindcss module. Installing tailwind as is on a project does not give this error.
I know it's a bit specific, but any help in the right direction would be greatly appreciated!

To Reproduce
Steps to reproduce the behavior:

  1. Install @nuxtjs/nuxt version 3
  2. Install the @nuxtjs/tailwindcss module
  3. Install vitest, nuxt-vitest, jest-dom, @testing-library/jest-dom
  4. Supply the property css:true in the vitest config, so css will be parsed
  5. Run an assertion that an element is visible
@rinux55 rinux55 added the bug Something isn't working label May 26, 2023
@btea
Copy link
Contributor

btea commented May 30, 2023

@rinux55 Hello, can you provide a simple code address?

@rinux55
Copy link
Author

rinux55 commented May 30, 2023

@btea thanks a lot for picking this up. I've created a demo for you.

https://stackblitz.com/edit/nuxt-starter-hgbacm?file=pages%2Findex.spec.ts

Running npm run test will trigger the error.

@btea
Copy link
Contributor

btea commented Jun 3, 2023

#943 should have fixed this issue.

capricorn86 added a commit that referenced this issue Jul 10, 2023
#939@patch: Correct parsing of pseudo elements by selectors.
@capricorn86
Copy link
Owner

Thank you for reporting @rinux55! 🙂

Big thanks to @btea for your contribution 🌟

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v10.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants