@@ -71,21 +71,42 @@ describe('Single File Component parser', () => {
71
71
const padLine = parseComponent ( content . trim ( ) , { pad : 'line' } )
72
72
const padSpace = parseComponent ( content . trim ( ) , { pad : 'space' } )
73
73
74
- expect ( padDefault . script . content ) . toBe ( Array ( 3 + 1 ) . join ( '//\n' ) + '\nexport default {}\n' )
75
- expect ( padDefault . styles [ 0 ] . content ) . toBe ( Array ( 6 + 1 ) . join ( '\n' ) + '\nh1 { color: red }\n' )
76
- expect ( padLine . script . content ) . toBe ( Array ( 3 + 1 ) . join ( '//\n' ) + '\nexport default {}\n' )
77
- expect ( padLine . styles [ 0 ] . content ) . toBe ( Array ( 6 + 1 ) . join ( '\n' ) + '\nh1 { color: red }\n' )
74
+ expect ( padDefault . template . content ) . toBe ( Array ( 1 ) . join ( '\n' ) + `
75
+ <div></div>
76
+ ` )
77
+ expect ( padDefault . script . content ) . toBe ( Array ( 3 + 1 ) . join ( '//\n' ) + `
78
+ export default {}
79
+ ` )
80
+ expect ( padDefault . styles [ 0 ] . content ) . toBe ( Array ( 6 + 1 ) . join ( '\n' ) + `
81
+ h1 { color: red }
82
+ ` )
83
+ expect ( padLine . template . content ) . toBe ( Array ( 1 ) . join ( '\n' ) + `
84
+ <div></div>
85
+ ` )
86
+ expect ( padLine . script . content ) . toBe ( Array ( 3 + 1 ) . join ( '//\n' ) + `
87
+ export default {}
88
+ ` )
89
+ expect ( padLine . styles [ 0 ] . content ) . toBe ( Array ( 6 + 1 ) . join ( '\n' ) + `
90
+ h1 { color: red }
91
+ ` )
92
+ expect ( padSpace . template . content ) . toBe ( `<template>` . replace ( / ./ g, ' ' ) + `
93
+ <div></div>
94
+ ` )
78
95
expect ( padSpace . script . content ) . toBe ( `<template>
79
96
<div></div>
80
97
</template>
81
- <script>` . replace ( / ./ g, ' ' ) + '\nexport default {}\n' )
98
+ <script>` . replace ( / ./ g, ' ' ) + `
99
+ export default {}
100
+ ` )
82
101
expect ( padSpace . styles [ 0 ] . content ) . toBe ( `<template>
83
102
<div></div>
84
103
</template>
85
104
<script>
86
105
export default {}
87
106
</script>
88
- <style>` . replace ( / ./ g, ' ' ) + '\nh1 { color: red }\n' )
107
+ <style>` . replace ( / ./ g, ' ' ) + `
108
+ h1 { color: red }
109
+ ` )
89
110
} )
90
111
91
112
it ( 'should handle template blocks with lang as special text' , ( ) => {
0 commit comments