-
Notifications
You must be signed in to change notification settings - Fork 2
/
imports_test.go
59 lines (51 loc) · 1.19 KB
/
imports_test.go
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
package cssc_test
import (
"testing"
"github.com/stephen/cssc"
"github.com/stephen/cssc/transforms"
"github.com/stretchr/testify/assert"
)
func TestImports(t *testing.T) {
t.Run("inline", func(t *testing.T) {
var errors TestReporter
result := cssc.Compile(cssc.Options{
Entry: []string{
"testdata/imports/index.css",
},
Reporter: &errors,
Transforms: transforms.Options{
ImportRules: transforms.ImportRulesInline,
},
})
assert.Len(t, result.Files, 1)
assert.Len(t, errors, 0)
})
t.Run("passthrough", func(t *testing.T) {
var errors TestReporter
result := cssc.Compile(cssc.Options{
Entry: []string{
"testdata/imports/index.css",
},
Reporter: &errors,
Transforms: transforms.Options{
ImportRules: transforms.ImportRulesPassthrough,
},
})
assert.Len(t, result.Files, 1)
assert.Len(t, errors, 0)
})
t.Run("follow", func(t *testing.T) {
var errors TestReporter
result := cssc.Compile(cssc.Options{
Entry: []string{
"testdata/imports/index.css",
},
Reporter: &errors,
Transforms: transforms.Options{
ImportRules: transforms.ImportRulesFollow,
},
})
assert.Len(t, result.Files, 3)
assert.Len(t, errors, 0)
})
}