Skip to content

Commit df05a02

Browse files
committed
Add postcss-import test
1 parent d32a3e3 commit df05a02

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/test-import.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.test-import { padding-left: 1rem }

src/test.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import postcss from 'postcss';
2+
import postcssImport from 'postcss-import';
23
import test from 'ava';
34
import plugin from './index';
45

56
const normalize = cssString => cssString
67
.replace(/} /g, '}'); /* fix extra space added by `postcss-import` */
78

8-
const run = (t, input, output, opts = {}) => postcss([plugin(opts)])
9+
const run = (t, input, output, opts = {}) => postcss([
10+
postcssImport,
11+
plugin(opts),
12+
])
913
.process(input, {from: undefined})
1014
.then((result) => {
1115
t.is(normalize(result.css), normalize(output));
@@ -294,3 +298,10 @@ test('rtl:as: directive', t => run(t,
294298

295299
'[dir=ltr]:root { --padding /* rtl:as:padding */: 1px 2px 3px 4px }'
296300
+ '[dir=rtl]:root { --padding /* rtl:as:padding */: 1px 4px 3px 2px }'));
301+
302+
test('import', t => run(t,
303+
'/* rtl:begin:ignore */'
304+
+ `@import "${__dirname}/test-import.css";`
305+
+ '/* rtl:end:ignore */',
306+
307+
'.test-import { padding-left: 1rem }'));

0 commit comments

Comments
 (0)