diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:58:02 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:58:02 +0800 |
| commit | fee47f6414cc3ae9a88f3ee0ed20f1d6f2d9f556 (patch) | |
| tree | 2b99dd57fc676a3819ef3cc46ac43df0043c2bb3 /node_modules/postcss-hexrgba/test | |
| parent | 0379526e20e1ff212df23e6326741aa9c06df204 (diff) | |
added plugin from postcss: postcss-fixes rucksack-css
Diffstat (limited to 'node_modules/postcss-hexrgba/test')
12 files changed, 80 insertions, 0 deletions
diff --git a/node_modules/postcss-hexrgba/test/fixtures/complex.css b/node_modules/postcss-hexrgba/test/fixtures/complex.css new file mode 100644 index 00000000..b7032ad7 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/complex.css @@ -0,0 +1,5 @@ + .foo { + background: linear-gradient(rgba(#0fab53,.1), rgba(#000, 0.2)); + background-image: linear-gradient(#f00, rgba(#f00, 0.2)), + linear-gradient(#0f0, rgba(#0f0, 0.2)); + } diff --git a/node_modules/postcss-hexrgba/test/fixtures/complex.expected.css b/node_modules/postcss-hexrgba/test/fixtures/complex.expected.css new file mode 100644 index 00000000..d9e8aaeb --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/complex.expected.css @@ -0,0 +1,5 @@ + .foo { + background: linear-gradient(rgba(15,171,83,.1), rgba(0,0,0, 0.2)); + background-image: linear-gradient(#f00, rgba(255,0,0, 0.2)), + linear-gradient(#0f0, rgba(0,255,0, 0.2)); + } diff --git a/node_modules/postcss-hexrgba/test/fixtures/important.css b/node_modules/postcss-hexrgba/test/fixtures/important.css new file mode 100644 index 00000000..19b79f67 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/important.css @@ -0,0 +1,4 @@ +.foo { + border: 1px solid rgba(#f00, 0.2) !important; + color: rgba(#f00,.2) !important; +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/important.expected.css b/node_modules/postcss-hexrgba/test/fixtures/important.expected.css new file mode 100644 index 00000000..956990f7 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/important.expected.css @@ -0,0 +1,4 @@ +.foo { + border: 1px solid rgba(255,0,0, 0.2) !important; + color: rgba(255,0,0,.2) !important; +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/multiple.css b/node_modules/postcss-hexrgba/test/fixtures/multiple.css new file mode 100644 index 00000000..c382bab6 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/multiple.css @@ -0,0 +1,4 @@ +.foo { + border: 1px solid rgba(#f00, 0.2); + border: rgba(#f00,.2) 1px solid; +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/multiple.expected.css b/node_modules/postcss-hexrgba/test/fixtures/multiple.expected.css new file mode 100644 index 00000000..2510009a --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/multiple.expected.css @@ -0,0 +1,4 @@ +.foo { + border: 1px solid rgba(255,0,0, 0.2); + border: rgba(255,0,0,.2) 1px solid; +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/shorthand.css b/node_modules/postcss-hexrgba/test/fixtures/shorthand.css new file mode 100644 index 00000000..6afa9e31 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/shorthand.css @@ -0,0 +1,4 @@ +.foo { + color: rgba(#fff, 0.5); + background: rgba(#000, .8); +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/shorthand.expected.css b/node_modules/postcss-hexrgba/test/fixtures/shorthand.expected.css new file mode 100644 index 00000000..a229ed70 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/shorthand.expected.css @@ -0,0 +1,4 @@ +.foo { + color: rgba(255,255,255, 0.5); + background: rgba(0,0,0, .8); +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/standard.css b/node_modules/postcss-hexrgba/test/fixtures/standard.css new file mode 100644 index 00000000..34f820b3 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/standard.css @@ -0,0 +1,4 @@ +.foo { + color: rgba(#ffffff, 0.5); + background: rgba(#00b2ff,.8); +} diff --git a/node_modules/postcss-hexrgba/test/fixtures/standard.expected.css b/node_modules/postcss-hexrgba/test/fixtures/standard.expected.css new file mode 100644 index 00000000..9dfe2dfb --- /dev/null +++ b/node_modules/postcss-hexrgba/test/fixtures/standard.expected.css @@ -0,0 +1,4 @@ +.foo { + color: rgba(255,255,255, 0.5); + background: rgba(0,178,255,.8); +} diff --git a/node_modules/postcss-hexrgba/test/mocha.opts b/node_modules/postcss-hexrgba/test/mocha.opts new file mode 100644 index 00000000..d9a95e80 --- /dev/null +++ b/node_modules/postcss-hexrgba/test/mocha.opts @@ -0,0 +1 @@ +--reporter nyan diff --git a/node_modules/postcss-hexrgba/test/test.js b/node_modules/postcss-hexrgba/test/test.js new file mode 100644 index 00000000..ad54cd2c --- /dev/null +++ b/node_modules/postcss-hexrgba/test/test.js @@ -0,0 +1,37 @@ +'use strict'; + +const postcss = require('postcss'); +const expect = require('chai').expect; +const fs = require('fs'); +const path = require('path'); +const plugin = require('../'); + +function test(fixture, opts, done) { + let input = fixture + '.css', + expected = fixture + '.expected.css'; + + input = fs.readFileSync(path.join(__dirname, 'fixtures', input), 'utf8'); + expected = fs.readFileSync(path.join(__dirname, 'fixtures', expected), 'utf8'); + + postcss([ plugin(opts) ]) + .process(input) + .then(result => { + expect(result.css).to.eql(expected); + expect(result.warnings()).to.be.empty; + done(); + }).catch(error => done(error)); +} + +describe('postcss-hexrgba', () => { + + it('handles standard hex', done => test('standard', {}, done)); + + it('handles shorthand hex', done => test('shorthand', {}, done)); + + it('handles hex in multiple attributes', done => test('multiple', {}, done)); + + it('handles complex statements', done => test('complex', {}, done)); + + it('preservers !important', done => test('important', {}, done)); + +}); |
