From 405b015fb30a52e02a1131b23f6fbe2602127dc9 Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Wed, 4 Nov 2020 18:17:48 -0500 Subject: [PATCH] Add failing test for @charset Refs #436 --- test/import.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/import.js b/test/import.js index 9b637c22..6cd10b2a 100644 --- a/test/import.js +++ b/test/import.js @@ -46,6 +46,17 @@ test("should not fail with absolute and local import", t => { .then(result => t.is(result.css, "@import url('http://');\nfoo{}")) }) +test("should keep @charset first", t => { + const base = "@charset 'utf-8';\n@import url(http://)" + return postcss() + .use(atImport()) + .process(base, { from: undefined }) + .then(result => { + t.is(result.warnings().length, 0) + t.is(result.css, base) + }) +}) + test("should error when file not found", t => { t.plan(1) const file = "test/fixtures/imports/import-missing.css"