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 --- .../test/fixtures/basic.actual.css | 3 + .../test/fixtures/basic.copy.actual.css | 4 ++ .../test/fixtures/basic.copy.expect.css | 4 ++ .../postcss-unopacity/test/fixtures/basic.css | 3 + .../test/fixtures/basic.expect.css | 3 + .../test/fixtures/basic.prefixed.actual.css | 3 + .../test/fixtures/basic.prefixed.expect.css | 3 + .../test/fixtures/basic.warn.actual.css | 3 + .../test/fixtures/basic.warn.expect.css | 3 + node_modules/postcss-unopacity/test/index.js | 83 ++++++++++++++++++++++ 10 files changed, 112 insertions(+) create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.actual.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.copy.actual.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.copy.expect.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.expect.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.prefixed.actual.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.prefixed.expect.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.warn.actual.css create mode 100644 node_modules/postcss-unopacity/test/fixtures/basic.warn.expect.css create mode 100644 node_modules/postcss-unopacity/test/index.js (limited to 'node_modules/postcss-unopacity/test') diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.actual.css b/node_modules/postcss-unopacity/test/fixtures/basic.actual.css new file mode 100644 index 00000000..3cd9eeb3 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.actual.css @@ -0,0 +1,3 @@ +.figure { + filter: alpha(opacity=50); +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.copy.actual.css b/node_modules/postcss-unopacity/test/fixtures/basic.copy.actual.css new file mode 100644 index 00000000..2a1aae19 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.copy.actual.css @@ -0,0 +1,4 @@ +.figure { + filter: alpha(opacity=50); + opacity: .5; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.copy.expect.css b/node_modules/postcss-unopacity/test/fixtures/basic.copy.expect.css new file mode 100644 index 00000000..2a1aae19 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.copy.expect.css @@ -0,0 +1,4 @@ +.figure { + filter: alpha(opacity=50); + opacity: .5; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.css b/node_modules/postcss-unopacity/test/fixtures/basic.css new file mode 100644 index 00000000..d63a75f7 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.css @@ -0,0 +1,3 @@ +.figure { + opacity: .5; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.expect.css b/node_modules/postcss-unopacity/test/fixtures/basic.expect.css new file mode 100644 index 00000000..3cd9eeb3 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.expect.css @@ -0,0 +1,3 @@ +.figure { + filter: alpha(opacity=50); +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.actual.css b/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.actual.css new file mode 100644 index 00000000..b5f6b3d2 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.actual.css @@ -0,0 +1,3 @@ +.figure { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.expect.css b/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.expect.css new file mode 100644 index 00000000..b5f6b3d2 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.prefixed.expect.css @@ -0,0 +1,3 @@ +.figure { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.warn.actual.css b/node_modules/postcss-unopacity/test/fixtures/basic.warn.actual.css new file mode 100644 index 00000000..d63a75f7 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.warn.actual.css @@ -0,0 +1,3 @@ +.figure { + opacity: .5; +} diff --git a/node_modules/postcss-unopacity/test/fixtures/basic.warn.expect.css b/node_modules/postcss-unopacity/test/fixtures/basic.warn.expect.css new file mode 100644 index 00000000..d63a75f7 --- /dev/null +++ b/node_modules/postcss-unopacity/test/fixtures/basic.warn.expect.css @@ -0,0 +1,3 @@ +.figure { + opacity: .5; +} diff --git a/node_modules/postcss-unopacity/test/index.js b/node_modules/postcss-unopacity/test/index.js new file mode 100644 index 00000000..b8243c58 --- /dev/null +++ b/node_modules/postcss-unopacity/test/index.js @@ -0,0 +1,83 @@ +var tests = { + 'postcss-unopacity': { + '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 + }, + 'basic:prefixed': { + message: 'supports "prefixed" usage', + options: { + prefixed: true + } + } + } +}; + +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