From fc19bc2e89ca995ee1ea5de63d9114de397a7f6f Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 24 Nov 2017 12:34:21 -0500 Subject: [PATCH] Add test to make sure custom config is actually used --- __tests__/customConfig.test.js | 28 ++++++++++++++++++++++++++++ __tests__/fixtures/customConfig.js | 5 +++++ 2 files changed, 33 insertions(+) create mode 100644 __tests__/customConfig.test.js create mode 100644 __tests__/fixtures/customConfig.js diff --git a/__tests__/customConfig.test.js b/__tests__/customConfig.test.js new file mode 100644 index 000000000..b39536d37 --- /dev/null +++ b/__tests__/customConfig.test.js @@ -0,0 +1,28 @@ +import path from 'path' +import postcss from 'postcss' +import tailwind from '../src/index' + +test('it uses the values from the custom config file', () => { + return postcss([tailwind(path.resolve(`${__dirname}/fixtures/customConfig.js`))]) + .process(` + @responsive { + .foo { + color: blue; + } + } + `) + .then(result => { + const expected = ` + .foo { + color: blue; + } + @media (min-width: 400px) { + .mobile\\:foo { + color: blue; + } + } + ` + + expect(result.css).toMatchCss(expected) + }) +}) diff --git a/__tests__/fixtures/customConfig.js b/__tests__/fixtures/customConfig.js new file mode 100644 index 000000000..495c7307d --- /dev/null +++ b/__tests__/fixtures/customConfig.js @@ -0,0 +1,5 @@ +module.exports = { + screens: { + mobile: '400px', + } +}