forked from ConciseCSS/concise.css
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (36 loc) · 1.03 KB
/
index.js
File metadata and controls
46 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const fs = require("fs")
const path = require('path')
const test = require('tape')
const postcss = require('postcss')
const concise = require('../src/index.js')
;(() => {
const actual = async file => {
const sourcePath = path.join(__dirname,`fixtures/${file}/${file}.pcss`)
const fileContent = fs.readFileSync(sourcePath, 'utf8')
const result = await postcss([concise]).process(fileContent, { from: sourcePath })
return result.css.replace(/\s+/g, '')
}
const expected = (file) =>
fs.readFileSync(
path.join(__dirname, `fixtures/${file}/${file}.css`),
'utf8'
).replace(/\s+/g, '')
test('Media queries', async (t) => {
t.equal(
await actual('customMedia'),
expected('customMedia'),
'Custom media queries')
t.equal(
await actual('mediaMinMax'),
expected('mediaMinMax'),
'Ranges in media queries')
t.end()
})
test('Units', async (t) => {
t.equal(
await actual('verticalRhythm'),
expected('verticalRhythm'),
'lh')
t.end()
})
})()