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

Add option explicitAmpersand on @emotion/cache to handle :is and :where, etc #3210

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Also ensure ampersand-less selector behavior
  • Loading branch information
thomaslindstrom committed Jul 12, 2024
commit 2e03829a16b5cfbc556039c0819796cab3199c22
53 changes: 16 additions & 37 deletions packages/cache/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ exports[`should not prefix pseudo-classes automatically when using explicitAmper
color: red;
}

.emotion-0 :is(p, ul)+:is(p, ul) {
margin-top: 1em;
}

.emotion-0:before {
content: 'test';
}
Expand Down Expand Up @@ -89,43 +93,7 @@ exports[`should not prefix pseudo-classes automatically when using explicitAmper
data-s=""
>

.emotion-0:before{content:'test';}
</style>
</div>
<div>
<div
class="emotion-0"
/>
</div>
</body>
`;

exports[`should not prefix pseudo-classes automatically when using option 1`] = `
:where([dir='rtl']) .emotion-0 {
color: red;
}

.emotion-0:before {
content: 'test';
}

<body>
<div
id="container"
>
<style
data-emotion="test-container"
data-s=""
>

.emotion-0{}
</style>
<style
data-emotion="test-container"
data-s=""
>

:where([dir='rtl']) .emotion-0{color:red;}
.emotion-0 :is(p, ul)+:is(p, ul){margin-top:1em;}
</style>
<style
data-emotion="test-container"
Expand All @@ -148,6 +116,10 @@ exports[`should prefix pseudo-classes automatically when not using explicitAmper
color: red;
}

.emotion-0:is(p, ul)+:is(p, ul) {
margin-top: 1em;
}

.emotion-0:before {
content: 'test';
}
Expand All @@ -170,6 +142,13 @@ exports[`should prefix pseudo-classes automatically when not using explicitAmper

.emotion-0:where([dir='rtl']) .emotion-0{color:red;}
</style>
<style
data-emotion="test-container"
data-s=""
>

.emotion-0:is(p, ul)+:is(p, ul){margin-top:1em;}
</style>
<style
data-emotion="test-container"
data-s=""
Expand Down
8 changes: 8 additions & 0 deletions packages/cache/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ it('should not prefix pseudo-classes automatically when using explicitAmpersand
color: red;
}

:is(p, ul) + :is(p, ul) {
margin-top: 1em;
}

&:before {
content: 'test';
}
Expand Down Expand Up @@ -101,6 +105,10 @@ it('should prefix pseudo-classes automatically when not using explicitAmpersand
color: red;
}

:is(p, ul) + :is(p, ul) {
margin-top: 1em;
}

&:before {
content: 'test';
}
Expand Down
Loading