@@ -190,7 +190,7 @@ describe('compiler sfc: rewriteDefault', () => {
190190 ) . toMatchInlineSnapshot ( `
191191 "/*
192192 export default class Foo {}*/
193- class Bar {}
193+ class Bar {}
194194 const script = Bar"
195195 ` )
196196 } )
@@ -206,7 +206,10 @@ describe('compiler sfc: rewriteDefault', () => {
206206
207207 test ( '@Component\nexport default class w/ comments' , async ( ) => {
208208 expect (
209- rewriteDefault ( `// export default\n@Component\nexport default class Foo {}` , 'script' )
209+ rewriteDefault (
210+ `// export default\n@Component\nexport default class Foo {}` ,
211+ 'script'
212+ )
210213 ) . toMatchInlineSnapshot ( `
211214 "// export default
212215 @Component
@@ -231,15 +234,78 @@ describe('compiler sfc: rewriteDefault', () => {
231234 test ( '@Component\nexport default class w/ comments 3' , async ( ) => {
232235 expect (
233236 rewriteDefault (
234- `/*\n@Component\nexport default class Foo {}*/\n` + `export default class Bar {}` ,
237+ `/*\n@Component\nexport default class Foo {}*/\n` +
238+ `export default class Bar {}` ,
235239 'script'
236240 )
237241 ) . toMatchInlineSnapshot ( `
238242 "/*
239243 @Component
240244 export default class Foo {}*/
241- class Bar {}
245+ class Bar {}
242246 const script = Bar"
243247 ` )
244248 } )
249+
250+ // #13060
251+ test ( '@Component\nexport default class w/ comments 4' , async ( ) => {
252+ expect (
253+ rewriteDefault (
254+ `@Component
255+ export default class App extends Vue {
256+ /* default <- This word means my component is not built correctly */
257+ @Prop({ type: String, required: true })
258+ protected someString: string;
259+ }` ,
260+ 'script'
261+ )
262+ ) . toMatchInlineSnapshot ( `
263+ "@Component
264+ class App extends Vue {
265+ /* default <- This word means my component is not built correctly */
266+ @Prop({ type: String, required: true })
267+ protected someString: string;
268+ }
269+ const script = App"
270+ ` )
271+ } )
272+
273+ // #12892
274+ test ( '@Component\nexport default class w/ comments 5' , async ( ) => {
275+ expect (
276+ rewriteDefault (
277+ `@Component({})
278+ export default class HelloWorld extends Vue {
279+ test = "";
280+ mounted() {
281+ console.log("mounted!");
282+ this.test = "Hallo Welt!";
283+ }
284+ exportieren(): void {
285+ // do nothing
286+ }
287+ defaultWert(): void {
288+ // do nothing
289+ }
290+ }` ,
291+ 'script' ,
292+ [ 'typescript' , 'decorators-legacy' ]
293+ )
294+ ) . toMatchInlineSnapshot ( `
295+ "@Component({}) class HelloWorld extends Vue {
296+ test = "";
297+ mounted() {
298+ console.log("mounted!");
299+ this.test = "Hallo Welt!";
300+ }
301+ exportieren(): void {
302+ // do nothing
303+ }
304+ defaultWert(): void {
305+ // do nothing
306+ }
307+ }
308+ const script = HelloWorld"
309+ ` )
310+ } )
245311} )
0 commit comments