Sha256: b186314cf80ad0d8cf71c00bc4cfce09047f2ec2ee26e5d6bf834b270e01010f

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

/* jshint node: true */
'use strict';

var fs = require('fs');
var path = require('path');
var postcss = require('postcss');

var csswring = require('../index');

var dirFixtures = path.join(__dirname, 'fixtures');
var dirExpected = path.join(__dirname, 'expected');
var input = '';
var expected = '';
var opts = {};
var loadInput = function (name) {
  return fs.readFileSync(path.join(dirFixtures, name + '.css'), {
    encoding: 'utf8'
  });
};
var loadExpected = function (name) {
  return fs.readFileSync(path.join(dirExpected, name + '.css'), {
    encoding: 'utf8'
  });
};

exports.testPublicInterfaces = function (test) {
  test.expect(3);

  input = '.foo{color:black}';
  expected = postcss.parse(input);
  test.strictEqual(csswring.wring(input).css, expected.toString());

  opts.map = true;
  test.strictEqual(
    csswring.wring(input, opts).map,
    expected.toResult(opts).map
  );

  test.strictEqual(
    postcss().use(csswring.processor).process(input).css,
    expected.toString()
  );

  test.done();
};

exports.testRealCSS = function (test) {
  test.expect(6);

  var testCases = [
    'simple',
    'extra-semicolons',
    'empty-declarations',
    'single-charset',
    'value',
    'issue3'
  ];

  for (var i = 0, l = testCases.length; i < l; i++) {
    var testCase = testCases[i];
    input = loadInput(testCase);
    expected = loadExpected(testCase);
    test.strictEqual(csswring.wring(input).css, expected);
  }

  test.done();
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pleeease-0.0.3 node_modules/pleeease/node_modules/csswring/test/csswring_test.js
pleeease-0.0.2 node_modules/pleeease/node_modules/csswring/test/csswring_test.js