summaryrefslogtreecommitdiff
path: root/node_modules/postcss-hexrgba/test/test.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/postcss-hexrgba/test/test.js')
-rw-r--r--node_modules/postcss-hexrgba/test/test.js37
1 files changed, 37 insertions, 0 deletions
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));
+
+});