"use strict";

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

var _ValueReplacer = _interopRequireDefault(require("../ValueReplacer"));

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

/* eslint-disable no-use-before-define */
describe('postcss value replacer tests', () => {
  it('is creating value replaced code', () => {
    const cssInputStr = `.abc{ cursor : text }`;
    const cssOutputStr = `.abc{ cursor : --textCursor }`;
    const cssOptions = [{
      props: ['font', 'font-family', 'cursor'],
      values: {
        'zdf-': 'zd-react-app-',
        '^text$': '--textCursor'
      }
    }];
    const result = runValueReplacerForCssString(cssInputStr, cssOptions);
    expect(result.css).toEqual(cssOutputStr);
  });
});
describe('postcss value replacer tests', () => {
  it('is creating value replaced code', () => {
    const cssInputStr = `.def{ cursor : var(--textBoxCursor) }`;
    const cssOutputStr = `.def{ cursor : var(--textBoxCursor) }`;
    const cssOptions = [{
      props: ['font', 'font-family', 'cursor'],
      values: {
        'zdf-': 'zd-react-app-',
        '^text$': '--textCursor'
      }
    }];
    const result = runValueReplacerForCssString(cssInputStr, cssOptions);
    expect(result.css).toEqual(cssOutputStr);
  });
});

function runValueReplacerForCssString(cssInputStr, cssOptions) {
  return (0, _postcss.default)([(0, _ValueReplacer.default)(cssOptions)]).process(cssInputStr);
}