Sha256: 0908fd81e7eace0c5657a33d570ddc177e9ba33d9d302220fef1ff716d1af19e

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

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

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

var mqpacker = 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(mqpacker.pack(input).css, expected.toString());

  opts.map = true;
  test.strictEqual(
    mqpacker.pack(input, opts).map,
    expected.toResult(opts).map
  );

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

  test.done();
};

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

  var testCases = [
    'simple',
    'multi',
    'query-order'
  ];

  for (var i = 0, l = testCases.length; i < l; i++) {
    var testCase = testCases[i];
    input = loadInput(testCase);
    expected = loadExpected(testCase);
    test.strictEqual(mqpacker.pack(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/css-mqpacker/test/css-mqpacker_test.js
pleeease-0.0.2 node_modules/pleeease/node_modules/css-mqpacker/test/css-mqpacker_test.js