From bb2c41b40eb251283e75da23263e5363dfe8d11d Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Thu, 18 Jan 2024 16:45:24 +0300 Subject: [PATCH 1/2] test: css nesting --- test/index.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/index.test.js b/test/index.test.js index d7f298c..8cb4a3e 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -62,6 +62,24 @@ describe("constants", () => { ":export {\n blue: red;\n}\n.foo { color: red; }" )); + it("should replace constants within the file #1", () => + test( + "@value blue: red; .foo { &.bar { color: blue; } }", + ":export {\n blue: red;\n} .foo { &.bar { color: red; } }" + )); + + it("should replace constants within the file #2", () => + test( + "@value blue: red; .foo { @media (min-width: 1024px) { &.bar { color: blue; } } }", + ":export {\n blue: red;\n} .foo { @media (min-width: 1024px) { &.bar { color: red; } } }" + )); + + it("should replace constants within the file #3", () => + test( + "@value blue: red; .foo { @media (min-width: 1024px) { &.bar { @media (min-width: 1024px) { color: blue; } } } }", + ":export {\n blue: red;\n} .foo { @media (min-width: 1024px) { &.bar { @media (min-width: 1024px) { color: red; } } } }" + )); + it("should replace selectors within the file", () => test( "@value colorValue: red; .colorValue { color: colorValue; }", From ff24b6f859e5b4d66f79de0eecc814fba83a704d Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Thu, 18 Jan 2024 16:49:11 +0300 Subject: [PATCH 2/2] test: more --- test/index.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/index.test.js b/test/index.test.js index 8cb4a3e..f246137 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -80,6 +80,12 @@ describe("constants", () => { ":export {\n blue: red;\n} .foo { @media (min-width: 1024px) { &.bar { @media (min-width: 1024px) { color: red; } } } }" )); + it("should replace constants within the file #4", () => + test( + "@value test-t: 40px;\n@value test_q: 36px; .foo { height: test-t; height: test_q; }", + ":export {\n test-t: 40px;\n test_q: 36px;\n}\n.foo { height: 40px; height: 36px; }" + )); + it("should replace selectors within the file", () => test( "@value colorValue: red; .colorValue { color: colorValue; }",