Skip to content
Merged
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
add advanced test with various combinations
  • Loading branch information
RobinMalfait committed Sep 24, 2024
commit c72b4be88d772effeee602dad4374a5b557a8f62
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,78 @@ it('should not migrate nested classes inside a `:not(…)`', async () => {
"
`)
})

it('should migrate advanced combinations', async () => {
expect(
await migrate(css`
@layer utilities {
@media (width >= 100px) {
@supports (display: none) {
.foo .bar:not(.qux):has(.baz) {
display: none;
}
}

.bar {
color: red;
}
}

@media (width >= 200px) {
.foo {
&:hover {
@apply bg-red-500;

.bar {
color: red;
}
}
}
}
}
`),
).toMatchInlineSnapshot(`
"@utility foo {
@media (width >= 100px) {
@supports (display: none) {
& .bar:not(.qux):has(.baz) {
display: none;
}
}
}
@media (width >= 200px) {
&:hover {
@apply bg-red-500;

.bar {
color: red;
}
}
}
}
@utility bar {
@media (width >= 100px) {
@supports (display: none) {
.foo &:not(.qux):has(.baz) {
display: none;
}
}
}
@media (width >= 100px) {
color: red;
}
}
@utility baz {
@media (width >= 100px) {
@supports (display: none) {
.foo .bar:not(.qux):has(&) {
display: none;
}
}
}
}


"
`)
})