From a0579f91bbdf0de62b59df381d97a008bb98df57 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 30 Oct 2023 16:45:38 +0800 Subject: update/upgrade --- .../postcss-unnot/test/fixtures/basic.actual.css | 3 + node_modules/postcss-unnot/test/fixtures/basic.css | 3 + .../postcss-unnot/test/fixtures/basic.expect.css | 3 + .../test/fixtures/basic.move.actual.css | 6 ++ .../test/fixtures/basic.move.expect.css | 6 ++ .../test/fixtures/basic.pseudo.actual.css | 3 + .../test/fixtures/basic.pseudo.expect.css | 3 + .../test/fixtures/basic.warn.expect.css | 3 + node_modules/postcss-unnot/test/index.js | 76 ++++++++++++++++++++++ 9 files changed, 106 insertions(+) create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.actual.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.expect.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.move.actual.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.move.expect.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.pseudo.actual.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.pseudo.expect.css create mode 100644 node_modules/postcss-unnot/test/fixtures/basic.warn.expect.css create mode 100644 node_modules/postcss-unnot/test/index.js (limited to 'node_modules/postcss-unnot/test') diff --git a/node_modules/postcss-unnot/test/fixtures/basic.actual.css b/node_modules/postcss-unnot/test/fixtures/basic.actual.css new file mode 100644 index 00000000..2db5893f --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.actual.css @@ -0,0 +1,3 @@ +.foo, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.css b/node_modules/postcss-unnot/test/fixtures/basic.css new file mode 100644 index 00000000..5fe9847f --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.css @@ -0,0 +1,3 @@ +.foo, .bar:not(.fail), .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.expect.css b/node_modules/postcss-unnot/test/fixtures/basic.expect.css new file mode 100644 index 00000000..2db5893f --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.expect.css @@ -0,0 +1,3 @@ +.foo, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.move.actual.css b/node_modules/postcss-unnot/test/fixtures/basic.move.actual.css new file mode 100644 index 00000000..5d7769f7 --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.move.actual.css @@ -0,0 +1,6 @@ +.bar:not(.fail) { + color: red; +} +.foo, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.move.expect.css b/node_modules/postcss-unnot/test/fixtures/basic.move.expect.css new file mode 100644 index 00000000..5d7769f7 --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.move.expect.css @@ -0,0 +1,6 @@ +.bar:not(.fail) { + color: red; +} +.foo, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.pseudo.actual.css b/node_modules/postcss-unnot/test/fixtures/basic.pseudo.actual.css new file mode 100644 index 00000000..92f63a6c --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.pseudo.actual.css @@ -0,0 +1,3 @@ +.foo, .bar, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.pseudo.expect.css b/node_modules/postcss-unnot/test/fixtures/basic.pseudo.expect.css new file mode 100644 index 00000000..92f63a6c --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.pseudo.expect.css @@ -0,0 +1,3 @@ +.foo, .bar, .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/fixtures/basic.warn.expect.css b/node_modules/postcss-unnot/test/fixtures/basic.warn.expect.css new file mode 100644 index 00000000..5fe9847f --- /dev/null +++ b/node_modules/postcss-unnot/test/fixtures/basic.warn.expect.css @@ -0,0 +1,3 @@ +.foo, .bar:not(.fail), .qux { + color: red; +} diff --git a/node_modules/postcss-unnot/test/index.js b/node_modules/postcss-unnot/test/index.js new file mode 100644 index 00000000..c883cc04 --- /dev/null +++ b/node_modules/postcss-unnot/test/index.js @@ -0,0 +1,76 @@ +var tests = { + 'postcss-unnot': { + 'basic': { + message: 'supports basic usage' + }, + 'basic:move': { + message: 'supports "move" method', + options: { + method: 'move' + } + }, + 'basic:pseudo': { + message: 'supports "pseudo" method', + options: { + method: 'pseudo' + } + } + } +}; + +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