@@ -190,7 +190,7 @@ describe('compiler sfc: rewriteDefault', () => {
190
190
) . toMatchInlineSnapshot ( `
191
191
"/*
192
192
export default class Foo {}*/
193
- class Bar {}
193
+ class Bar {}
194
194
const script = Bar"
195
195
` )
196
196
} )
@@ -206,7 +206,10 @@ describe('compiler sfc: rewriteDefault', () => {
206
206
207
207
test ( '@Component\nexport default class w/ comments' , async ( ) => {
208
208
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
+ )
210
213
) . toMatchInlineSnapshot ( `
211
214
"// export default
212
215
@Component
@@ -231,15 +234,78 @@ describe('compiler sfc: rewriteDefault', () => {
231
234
test ( '@Component\nexport default class w/ comments 3' , async ( ) => {
232
235
expect (
233
236
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 {}` ,
235
239
'script'
236
240
)
237
241
) . toMatchInlineSnapshot ( `
238
242
"/*
239
243
@Component
240
244
export default class Foo {}*/
241
- class Bar {}
245
+ class Bar {}
242
246
const script = Bar"
243
247
` )
244
248
} )
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
+ } )
245
311
} )
0 commit comments