-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtranform-template.test.ts
More file actions
59 lines (52 loc) · 2.41 KB
/
Copy pathtranform-template.test.ts
File metadata and controls
59 lines (52 loc) · 2.41 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
47
48
49
50
51
52
53
54
55
56
57
58
59
import { describe, it, expect } from 'vitest'
import { getModuleSource, vueWebpackCompiler, reactWebpackCompiler } from './helpers'
describe("Transform template test", function() {
it("should render jsx", done => {
const compiler = reactWebpackCompiler()
compiler.run((err, stats) => {
expect(stats.compilation.errors).toStrictEqual([])
let transformedLayout = getModuleSource('layout.jsx', stats)
expect(transformedLayout).not.toContain('@apply')
expect(transformedLayout).toMatchSnapshot('layout1')
transformedLayout = getModuleSource('layout2.jsx', stats)
expect(transformedLayout).not.toContain('@apply')
expect(transformedLayout).toMatchSnapshot('layout2')
// check the windi file has generated the right classes
const windi = getModuleSource('virtual:windi.css', stats)
expect(windi).toContain('bg-blue-500')
expect(windi).toMatchSnapshot('vue windi')
done(err)
});
});
it('should render vue', done => {
const compiler = vueWebpackCompiler()
compiler.run((err, stats) => {
expect(stats.compilation.errors).toStrictEqual([])
const transformedLayout = getModuleSource('App.vue?vue&type=template', stats)
expect(transformedLayout).not.toContain('hover:(text-green-100 rounded-full bg-teal-900)')
expect(transformedLayout).toMatchSnapshot('vue template')
// check the windi file has generated the right classes
const windi = getModuleSource('virtual:windi.css', stats)
expect(windi).toContain('text-green-100')
expect(windi).toMatchSnapshot('vue windi')
const scss = getModuleSource('main.scss', stats)
expect(scss).not.toContain('@apply')
expect(scss).toContain('background-color:')
expect(scss).toMatchSnapshot('vue scss')
// .sass seems to be broken
// const sass = getModuleSource('main.sass', stats)
// expect(sass).not.toContain('@apply')
// expect(sass).toContain('background-color:')
// expect(sass).toMatchSnapshot('vue sass')
const less = getModuleSource('main.less', stats)
expect(less).not.toContain('@apply')
expect(less).toContain('background-color:')
expect(less).toMatchSnapshot('vue less')
const css = getModuleSource('plain.css', stats)
expect(css).not.toContain('@apply')
expect(css).toContain('background-color:')
expect(css).toMatchSnapshot('vue css')
done(err)
});
});
});