Skip to content

Commit

Permalink
test: more (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Jan 17, 2024
1 parent a8c3d77 commit 82628c2
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,125 @@ const tests = [
options: { mode: "pure" },
error: /is not pure/,
},
{
name: "css nesting",
input: `
.foo {
&.class {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
.bar {
c_value: some-value;
}
&.baz {
c_value: some-value;
}
}
}`,
expected: `
:local(.foo) {
&:local(.class) {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
:local(.bar) {
c_value: some-value;
}
&:local(.baz) {
c_value: some-value;
}
}
}`,
},
{
name: "css nesting #1",
options: { mode: "global" },
input: `
:local(.foo) {
&:local(.class) {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
:local(.bar) {
c_value: some-value;
}
&:local(.baz) {
c_value: some-value;
}
}
}`,
expected: `
:local(.foo) {
&:local(.class) {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
:local(.bar) {
c_value: some-value;
}
&:local(.baz) {
c_value: some-value;
}
}
}`,
},
{
name: "css nesting #2",
options: { mode: "pure" },
input: `
.foo {
&.class {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
.bar {
c_value: some-value;
}
&.baz {
c_value: some-value;
}
}
}`,
expected: `
:local(.foo) {
&:local(.class) {
a_value: some-value;
}
@media screen and (min-width: 900px) {
b_value: some-value;
:local(.bar) {
c_value: some-value;
}
&:local(.baz) {
c_value: some-value;
}
}
}`,
},
/*
Bug in postcss-selector-parser
{
Expand Down

0 comments on commit 82628c2

Please sign in to comment.