summaryrefslogtreecommitdiff
path: root/node_modules/postcss-hexrgba/test/test.js
blob: ad54cd2cb076f84a9f6e048d396994f12169e31b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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));

});