@@ -41,7 +41,8 @@ tester.run('custom-event-name-casing', rule, {
41
41
}
42
42
}
43
43
</script>
44
- `
44
+ ` ,
45
+ options : [ 'kebab-case' ]
45
46
} ,
46
47
{
47
48
filename : 'test.vue' ,
@@ -67,7 +68,8 @@ tester.run('custom-event-name-casing', rule, {
67
68
}
68
69
}
69
70
</script>
70
- `
71
+ ` ,
72
+ options : [ 'kebab-case' ]
71
73
} ,
72
74
{
73
75
filename : 'test.vue' ,
@@ -92,7 +94,8 @@ tester.run('custom-event-name-casing', rule, {
92
94
}
93
95
}
94
96
</script>
95
- `
97
+ ` ,
98
+ options : [ 'kebab-case' ]
96
99
} ,
97
100
{
98
101
filename : 'test.vue' ,
@@ -117,7 +120,8 @@ tester.run('custom-event-name-casing', rule, {
117
120
}
118
121
}
119
122
</script>
120
- `
123
+ ` ,
124
+ options : [ 'kebab-case' ]
121
125
} ,
122
126
{
123
127
filename : 'test.vue' ,
@@ -149,7 +153,8 @@ tester.run('custom-event-name-casing', rule, {
149
153
},
150
154
}
151
155
</script>
152
- `
156
+ ` ,
157
+ options : [ 'kebab-case' ]
153
158
} ,
154
159
{
155
160
filename : 'test.vue' ,
@@ -165,7 +170,8 @@ tester.run('custom-event-name-casing', rule, {
165
170
},
166
171
}
167
172
</script>
168
- `
173
+ ` ,
174
+ options : [ 'kebab-case' ]
169
175
} ,
170
176
{
171
177
filename : 'test.vue' ,
@@ -269,6 +275,60 @@ tester.run('custom-event-name-casing', rule, {
269
275
</script>
270
276
` ,
271
277
options : [ 'camelCase' ]
278
+ } ,
279
+ // Default
280
+ {
281
+ filename : 'test.vue' ,
282
+ code : `
283
+ <template>
284
+ <input
285
+ @click="$emit('fooBar')">
286
+ </template>
287
+ <script>
288
+ export default {
289
+ setup(props, context) {
290
+ return {
291
+ onInput(value) {
292
+ context.emit('barBaz')
293
+ }
294
+ }
295
+ },
296
+ methods: {
297
+ onClick() {
298
+ this.$emit('bazQux')
299
+ }
300
+ }
301
+ }
302
+ </script>
303
+ `
304
+ } ,
305
+
306
+ // kebab-case
307
+ {
308
+ filename : 'test.vue' ,
309
+ code : `
310
+ <template>
311
+ <input
312
+ @click="$emit('foo-bar')">
313
+ </template>
314
+ <script>
315
+ export default {
316
+ setup(props, context) {
317
+ return {
318
+ onInput(value) {
319
+ context.emit('bar-baz')
320
+ }
321
+ }
322
+ },
323
+ methods: {
324
+ onClick() {
325
+ this.$emit('baz-qux')
326
+ }
327
+ }
328
+ }
329
+ </script>
330
+ ` ,
331
+ options : [ 'kebab-case' ]
272
332
}
273
333
] ,
274
334
invalid : [
@@ -296,6 +356,7 @@ tester.run('custom-event-name-casing', rule, {
296
356
}
297
357
</script>
298
358
` ,
359
+ options : [ 'kebab-case' ] ,
299
360
errors : [
300
361
{
301
362
message : "Custom event name 'fooBar' must be kebab-case." ,
@@ -344,6 +405,7 @@ tester.run('custom-event-name-casing', rule, {
344
405
}
345
406
</script>
346
407
` ,
408
+ options : [ 'kebab-case' ] ,
347
409
errors : [
348
410
"Custom event name 'fooBar' must be kebab-case." ,
349
411
"Custom event name 'barBaz' must be kebab-case." ,
@@ -374,6 +436,7 @@ tester.run('custom-event-name-casing', rule, {
374
436
}
375
437
</script>
376
438
` ,
439
+ options : [ 'kebab-case' ] ,
377
440
errors : [
378
441
"Custom event name 'fooBar' must be kebab-case." ,
379
442
"Custom event name 'barBaz' must be kebab-case." ,
@@ -448,6 +511,7 @@ tester.run('custom-event-name-casing', rule, {
448
511
"Custom event name 'click/row' must be kebab-case."
449
512
]
450
513
} ,
514
+ // camelCase
451
515
{
452
516
filename : 'test.vue' ,
453
517
code : `
@@ -479,6 +543,69 @@ tester.run('custom-event-name-casing', rule, {
479
543
"Custom event name 'baz-qux' must be camelCase."
480
544
]
481
545
} ,
546
+ // Default
547
+ {
548
+ filename : 'test.vue' ,
549
+ code : `
550
+ <template>
551
+ <input
552
+ @click="$emit('foo-bar')">
553
+ </template>
554
+ <script>
555
+ export default {
556
+ setup(props, context) {
557
+ return {
558
+ onInput(value) {
559
+ context.emit('bar-baz')
560
+ }
561
+ }
562
+ },
563
+ methods: {
564
+ onClick() {
565
+ this.$emit('baz-qux')
566
+ }
567
+ }
568
+ }
569
+ </script>
570
+ ` ,
571
+ errors : [
572
+ "Custom event name 'foo-bar' must be camelCase." ,
573
+ "Custom event name 'bar-baz' must be camelCase." ,
574
+ "Custom event name 'baz-qux' must be camelCase."
575
+ ]
576
+ } ,
577
+ // kebab-case
578
+ {
579
+ filename : 'test.vue' ,
580
+ code : `
581
+ <template>
582
+ <input
583
+ @click="$emit('fooBar')">
584
+ </template>
585
+ <script>
586
+ export default {
587
+ setup(props, context) {
588
+ return {
589
+ onInput(value) {
590
+ context.emit('barBaz')
591
+ }
592
+ }
593
+ },
594
+ methods: {
595
+ onClick() {
596
+ this.$emit('bazQux')
597
+ }
598
+ }
599
+ }
600
+ </script>
601
+ ` ,
602
+ options : [ 'kebab-case' ] ,
603
+ errors : [
604
+ "Custom event name 'fooBar' must be kebab-case." ,
605
+ "Custom event name 'barBaz' must be kebab-case." ,
606
+ "Custom event name 'bazQux' must be kebab-case."
607
+ ]
608
+ } ,
482
609
{
483
610
filename : 'test.vue' ,
484
611
code : `
@@ -490,8 +617,8 @@ tester.run('custom-event-name-casing', rule, {
490
617
` ,
491
618
errors : [
492
619
{
493
- message : "Custom event name 'fooBar ' must be kebab-case ." ,
494
- line : 4
620
+ message : "Custom event name 'foo-bar ' must be camelCase ." ,
621
+ line : 5
495
622
}
496
623
]
497
624
}
0 commit comments