From 144106e5b1af8589bdf76fd97af62b28b7e80fea Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Mon, 7 Aug 2023 16:41:44 -0700 Subject: [PATCH] test: add a failing test for #964 --- .../processor/test/__snapshots__/values.test.js.snap | 9 +++++++++ packages/processor/test/specimens/deep-namespace/a.css | 5 +++++ packages/processor/test/specimens/deep-namespace/b.css | 3 +++ packages/processor/test/specimens/deep-namespace/c.css | 1 + packages/processor/test/values.test.js | 8 ++++++++ 5 files changed, 26 insertions(+) create mode 100644 packages/processor/test/specimens/deep-namespace/a.css create mode 100644 packages/processor/test/specimens/deep-namespace/b.css create mode 100644 packages/processor/test/specimens/deep-namespace/c.css diff --git a/packages/processor/test/__snapshots__/values.test.js.snap b/packages/processor/test/__snapshots__/values.test.js.snap index 80424d750..76cbfec73 100644 --- a/packages/processor/test/__snapshots__/values.test.js.snap +++ b/packages/processor/test/__snapshots__/values.test.js.snap @@ -36,6 +36,15 @@ exports[`/processor.js values should support importing variables from a file 1`] " `; +exports[`/processor.js values should support layers of namespaced value references 1`] = ` +"/* packages/processor/test/specimens/deep-namespace/c.css */ +/* packages/processor/test/specimens/deep-namespace/b.css */ +/* packages/processor/test/specimens/deep-namespace/a.css */ +.mc_a { + color: cyan; +}" +`; + exports[`/processor.js values should support local values in value composition 1`] = ` "/* packages/processor/test/specimens/folder/folder.css */ .mc_folder { margin: 2px; } diff --git a/packages/processor/test/specimens/deep-namespace/a.css b/packages/processor/test/specimens/deep-namespace/a.css new file mode 100644 index 000000000..e01c02211 --- /dev/null +++ b/packages/processor/test/specimens/deep-namespace/a.css @@ -0,0 +1,5 @@ +@value b from "./b.css"; + +.a { + color: b; +} \ No newline at end of file diff --git a/packages/processor/test/specimens/deep-namespace/b.css b/packages/processor/test/specimens/deep-namespace/b.css new file mode 100644 index 000000000..28fbc3792 --- /dev/null +++ b/packages/processor/test/specimens/deep-namespace/b.css @@ -0,0 +1,3 @@ +@value * as values from "./c.css"; + +@value b: values.c; \ No newline at end of file diff --git a/packages/processor/test/specimens/deep-namespace/c.css b/packages/processor/test/specimens/deep-namespace/c.css new file mode 100644 index 000000000..7efcfd9ef --- /dev/null +++ b/packages/processor/test/specimens/deep-namespace/c.css @@ -0,0 +1 @@ +@value c: cyan; \ No newline at end of file diff --git a/packages/processor/test/values.test.js b/packages/processor/test/values.test.js index 9d47e74aa..877e2f481 100644 --- a/packages/processor/test/values.test.js +++ b/packages/processor/test/values.test.js @@ -195,5 +195,13 @@ describe("/processor.js", () => { expect(css).toMatchSnapshot(); }); + + it.only("should support layers of namespaced value references", async () => { + await processor.file(require.resolve("./specimens/deep-namespace/a.css")); + + const { css } = await processor.output(); + + expect(css).toMatchSnapshot(); + }); }); });