From fee47f6414cc3ae9a88f3ee0ed20f1d6f2d9f556 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 14 Oct 2023 15:58:02 +0800 Subject: added plugin from postcss: postcss-fixes rucksack-css --- .../postcss-unroot/test/fixtures/basic.actual.css | 3 + .../test/fixtures/basic.copy.actual.css | 6 ++ .../test/fixtures/basic.copy.expect.css | 6 ++ .../postcss-unroot/test/fixtures/basic.css | 3 + .../postcss-unroot/test/fixtures/basic.expect.css | 3 + .../test/fixtures/basic.warn.actual.css | 3 + .../test/fixtures/basic.warn.expect.css | 3 + .../postcss-unroot/test/fixtures/class.actual.css | 3 + .../postcss-unroot/test/fixtures/class.css | 3 + .../postcss-unroot/test/fixtures/class.expect.css | 3 + .../postcss-unroot/test/fixtures/svg.actual.css | 3 + node_modules/postcss-unroot/test/fixtures/svg.css | 3 + .../postcss-unroot/test/fixtures/svg.expect.css | 3 + node_modules/postcss-unroot/test/index.js | 83 ++++++++++++++++++++++ 14 files changed, 128 insertions(+) create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.actual.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.copy.actual.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.copy.expect.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.expect.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.warn.actual.css create mode 100644 node_modules/postcss-unroot/test/fixtures/basic.warn.expect.css create mode 100644 node_modules/postcss-unroot/test/fixtures/class.actual.css create mode 100644 node_modules/postcss-unroot/test/fixtures/class.css create mode 100644 node_modules/postcss-unroot/test/fixtures/class.expect.css create mode 100644 node_modules/postcss-unroot/test/fixtures/svg.actual.css create mode 100644 node_modules/postcss-unroot/test/fixtures/svg.css create mode 100644 node_modules/postcss-unroot/test/fixtures/svg.expect.css create mode 100644 node_modules/postcss-unroot/test/index.js (limited to 'node_modules/postcss-unroot/test') diff --git a/node_modules/postcss-unroot/test/fixtures/basic.actual.css b/node_modules/postcss-unroot/test/fixtures/basic.actual.css new file mode 100644 index 00000000..2c0cc73b --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.actual.css @@ -0,0 +1,3 @@ +html { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.copy.actual.css b/node_modules/postcss-unroot/test/fixtures/basic.copy.actual.css new file mode 100644 index 00000000..e062ae5d --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.copy.actual.css @@ -0,0 +1,6 @@ +html { + color: red; +} +:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.copy.expect.css b/node_modules/postcss-unroot/test/fixtures/basic.copy.expect.css new file mode 100644 index 00000000..e062ae5d --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.copy.expect.css @@ -0,0 +1,6 @@ +html { + color: red; +} +:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.css b/node_modules/postcss-unroot/test/fixtures/basic.css new file mode 100644 index 00000000..b5c5c477 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.css @@ -0,0 +1,3 @@ +:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.expect.css b/node_modules/postcss-unroot/test/fixtures/basic.expect.css new file mode 100644 index 00000000..2c0cc73b --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.expect.css @@ -0,0 +1,3 @@ +html { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.warn.actual.css b/node_modules/postcss-unroot/test/fixtures/basic.warn.actual.css new file mode 100644 index 00000000..b5c5c477 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.warn.actual.css @@ -0,0 +1,3 @@ +:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/basic.warn.expect.css b/node_modules/postcss-unroot/test/fixtures/basic.warn.expect.css new file mode 100644 index 00000000..b5c5c477 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/basic.warn.expect.css @@ -0,0 +1,3 @@ +:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/class.actual.css b/node_modules/postcss-unroot/test/fixtures/class.actual.css new file mode 100644 index 00000000..586a912b --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/class.actual.css @@ -0,0 +1,3 @@ +html.foo { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/class.css b/node_modules/postcss-unroot/test/fixtures/class.css new file mode 100644 index 00000000..5dfd4d4e --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/class.css @@ -0,0 +1,3 @@ +:root.foo { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/class.expect.css b/node_modules/postcss-unroot/test/fixtures/class.expect.css new file mode 100644 index 00000000..586a912b --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/class.expect.css @@ -0,0 +1,3 @@ +html.foo { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/svg.actual.css b/node_modules/postcss-unroot/test/fixtures/svg.actual.css new file mode 100644 index 00000000..7ad6e896 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/svg.actual.css @@ -0,0 +1,3 @@ +svg { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/svg.css b/node_modules/postcss-unroot/test/fixtures/svg.css new file mode 100644 index 00000000..9ac9f497 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/svg.css @@ -0,0 +1,3 @@ +svg:root { + color: red; +} diff --git a/node_modules/postcss-unroot/test/fixtures/svg.expect.css b/node_modules/postcss-unroot/test/fixtures/svg.expect.css new file mode 100644 index 00000000..7ad6e896 --- /dev/null +++ b/node_modules/postcss-unroot/test/fixtures/svg.expect.css @@ -0,0 +1,3 @@ +svg { + color: red; +} diff --git a/node_modules/postcss-unroot/test/index.js b/node_modules/postcss-unroot/test/index.js new file mode 100644 index 00000000..a421357c --- /dev/null +++ b/node_modules/postcss-unroot/test/index.js @@ -0,0 +1,83 @@ +var tests = { + 'postcss-unroot': { + 'basic': { + message: 'supports basic usage' + }, + 'basic:copy': { + message: 'supports "copy" usage', + options: { + method: 'copy' + } + }, + 'basic:warn': { + message: 'supports "warn" usage', + options: { + method: 'warn' + }, + warning: 1 + }, + 'svg': { + message: 'supports usage with ' + }, + 'class': { + message: 'supports usage with class' + } + } +}; + +var debug = true; +var dir = './test/fixtures/'; + +var fs = require('fs'); +var path = require('path'); +var plugin = require('../'); +var test = require('tape'); + +Object.keys(tests).forEach(function (name) { + var parts = tests[name]; + + test(name, function (t) { + var fixtures = Object.keys(parts); + + t.plan(fixtures.length * 2); + + fixtures.forEach(function (fixture) { + var message = parts[fixture].message; + var options = parts[fixture].options; + var warning = parts[fixture].warning || 0; + var warningMsg = message + ' (# of warnings)'; + + var baseName = fixture.split(':')[0]; + var testName = fixture.split(':').join('.'); + + var inputPath = path.resolve(dir + baseName + '.css'); + var expectPath = path.resolve(dir + testName + '.expect.css'); + var actualPath = path.resolve(dir + testName + '.actual.css'); + + var inputCSS = ''; + var expectCSS = ''; + + try { + inputCSS = fs.readFileSync(inputPath, 'utf8'); + } catch (error) { + fs.writeFileSync(inputPath, inputCSS); + } + + try { + expectCSS = fs.readFileSync(expectPath, 'utf8'); + } catch (error) { + fs.writeFileSync(expectPath, expectCSS); + } + + plugin.process(inputCSS, options).then(function (result) { + var actualCSS = result.css; + + if (debug) fs.writeFileSync(actualPath, actualCSS); + + t.equal(actualCSS, expectCSS, message); + + t.equal(result.warnings().length, warning, warningMsg); + }); + }); + }); +}); -- cgit v1.2.3