"use strict";

var _postcss = _interopRequireDefault(require("postcss"));

var _getSpecificPostCssPlugin = require("../getSpecificPostCssPlugin");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable no-use-before-define */
// import { checkIsPatternsMatchFilename } from '../filterPluginsAllowedForSpecficFile';
describe('postcss-rtl plugin basic requirement tests', () => {
  it('is creating rtl css code for for margin-left', () => {
    const cssInputStr = '.main{margin-left:20px}';
    const cssOutputStr = '[dir=ltr] .main{margin-left:20px}[dir=rtl] .main{margin-right:20px}';
    const result = runRTLPostCssPluginForCssString(cssInputStr);
    expect(result.css).toEqual(cssOutputStr);
  });
  it('is creating rtl css code for for margin-right', cb => {
    const cssInputStr = '.main{margin-right:20px}';
    const cssOutputStr = '[dir=ltr] .main{margin-right:20px}[dir=rtl] .main{margin-left:20px}'; // console.log(postcss);

    runRTLPostCssPluginForCssString(cssInputStr).then(res => {
      expect(res.css).toEqual(cssOutputStr);
      cb();
    });
  });
});

function runRTLPostCssPluginForCssString(cssInputStr) {
  return (0, _postcss.default)([(0, _getSpecificPostCssPlugin.configPostCssRtl)()]).process(cssInputStr, {
    from: '',
    to: ''
  });
}