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

:not selector work wrong #22

Closed
voskresla opened this issue Jul 13, 2020 · 4 comments
Closed

:not selector work wrong #22

voskresla opened this issue Jul 13, 2020 · 4 comments

Comments

@voskresla
Copy link
Contributor

I made example, just run npm i && npx jest master...voskresla:bug-with-not-selector

With css:

.class2, .class3 {
    display: block;
    color: #fff;
}
.class3:not(.class1) {
    color: black
}

we expected Object like:

{
  "class1": "class1",
  "class2": "class2",
  "class3": "class3",
}

but received object is:

Snapshot name: `Style with :not selector should import default 1`

    - Snapshot  - 1
    + Received  + 1

      Object {
    -   "class1": "class1",
    +   "class1)": "class1)",
        "class2": "class2",
        "class3": "class3",
      }

      7 | });
voskresla added a commit to voskresla/jest-css-modules-transform that referenced this issue Jul 13, 2020
- fix issue Connormiha#22
- add test for imports css with :not selector
@yepninja
Copy link

yepninja commented Jul 14, 2020

@Connormiha
Maybe it is better to use https://www.npmjs.com/package/postcss-selector-parser for parsing selectors and collecting classes?
Or is there any reasons why you don't want to use it?

@Connormiha
Copy link
Owner

@yepninja
Main reason is performance. I prefer reduce count of dependencies and add extended library only when there is a very good reason.

@yepninja
Copy link

postcss-selector-parser is the standard library for postcss. There is even an issue to integrate it natively to postcss.

Connormiha pushed a commit that referenced this issue Jul 14, 2020
* fix(parser): change regexp to match .class

- fix issue #22
- add test for imports css with :not selector

Co-authored-by: Stepan Polevshchikov <spolevshchikov@ozon.ru>
@Connormiha
Copy link
Owner

Fix in 4.0.1

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

No branches or pull requests

3 participants