-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
63 lines (54 loc) · 1.19 KB
/
index.test.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path');
const merge = require('lodash/merge');
const cssMatcher = require('jest-matcher-css');
const postcss = require('postcss');
const tailwindcss = require('tailwindcss');
const customPlugin = require('./index.js');
expect.extend({
toMatchCss: cssMatcher,
});
function generatePluginCss(overrides) {
const config = {
corePlugins: true,
plugins: [customPlugin],
};
return postcss(tailwindcss(merge(config, overrides)))
.process('html { @apply pro-rata-rem--inclusive; }', {
from: `${path.resolve(__filename)}`,
})
.then(({ css }) => css);
}
test('component classes can be generated', () => {
return generatePluginCss().then(css => {
expect(css).toMatchCss(`
html {
font-size: 16px;
}
@media (min-width: 640px) {
html {
font-size: 16px;
}
}
@media (min-width: 768px) {
html {
font-size: 20px;
}
}
@media (min-width: 1024px) {
html {
font-size: 24px;
}
}
@media (min-width: 1280px) {
html {
font-size: 24px;
}
}
@media (min-width: 1536px) {
html {
font-size: 28px;
}
}
`);
});
});