From 3f9c7c9ab9d917e14566cb8eca068f686f96650f Mon Sep 17 00:00:00 2001 From: Bart Veneman <1536852+bartveneman@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:20:30 +0200 Subject: [PATCH] remove unknown print for rule prelude --- index.js | 3 --- test/selectors.test.js | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 98245fb..e5be002 100644 --- a/index.js +++ b/index.js @@ -75,9 +75,6 @@ export function format(css, { minify = false } = {}) { if (prelude.type === TYPE_SELECTORLIST) { buffer = print_selectorlist(prelude) - } else { - // In case parsing the selector list fails we'll print it as-is - buffer = print_unknown(prelude, indent_level) } if (block.type === TYPE_BLOCK) { diff --git a/test/selectors.test.js b/test/selectors.test.js index 0defc81..52c6570 100644 --- a/test/selectors.test.js +++ b/test/selectors.test.js @@ -168,4 +168,16 @@ li:nth-child() {}` assert.equal(actual, expected) }) +test('formats unknown pseudos correctly', () => { + let actual = format(` + ::foo-bar, + :unkown-thing(), + :unnowkn(kjsa.asddk,asd) {} + `) + let expected = `::foo-bar, +:unkown-thing(), +:unnowkn(kjsa.asddk,asd) {}` + assert.equal(actual, expected) +}) + test.run()