@@ -121,6 +121,13 @@ ruleTester.run('prop-name-casing', rule, {
121121 }
122122 }
123123 ` ,
124+ output : `
125+ export default {
126+ props: {
127+ greetingText: String
128+ }
129+ }
130+ ` ,
124131 parserOptions,
125132 errors : [ {
126133 message : 'Prop "greeting_text" is not in camelCase.' ,
@@ -138,6 +145,13 @@ ruleTester.run('prop-name-casing', rule, {
138145 }
139146 ` ,
140147 options : [ 'camelCase' ] ,
148+ output : `
149+ export default {
150+ props: {
151+ greetingText: String
152+ }
153+ }
154+ ` ,
141155 parserOptions,
142156 errors : [ {
143157 message : 'Prop "greeting_text" is not in camelCase.' ,
@@ -155,6 +169,13 @@ ruleTester.run('prop-name-casing', rule, {
155169 }
156170 ` ,
157171 options : [ 'snake_case' ] ,
172+ output : `
173+ export default {
174+ props: {
175+ greeting_text: String
176+ }
177+ }
178+ ` ,
158179 parserOptions,
159180 errors : [ {
160181 message : 'Prop "greetingText" is not in snake_case.' ,
@@ -172,6 +193,13 @@ ruleTester.run('prop-name-casing', rule, {
172193 }
173194 ` ,
174195 options : [ 'camelCase' ] ,
196+ output : `
197+ export default {
198+ props: {
199+ 'greetingText': String
200+ }
201+ }
202+ ` ,
175203 parserOptions,
176204 errors : [ {
177205 message : 'Prop "greeting-text" is not in camelCase.' ,
@@ -189,12 +217,156 @@ ruleTester.run('prop-name-casing', rule, {
189217 }
190218 ` ,
191219 options : [ 'snake_case' ] ,
220+ output : `
221+ export default {
222+ props: {
223+ 'greeting_text': String
224+ }
225+ }
226+ ` ,
192227 parserOptions,
193228 errors : [ {
194229 message : 'Prop "greeting-text" is not in snake_case.' ,
195230 type : 'Property' ,
196231 line : 4
197232 } ]
233+ } ,
234+ {
235+ filename : 'test.vue' ,
236+ code : `
237+ export default {
238+ props: {
239+ 'greeting_text': String
240+ }
241+ }
242+ ` ,
243+ output : `
244+ export default {
245+ props: {
246+ 'greetingText': String
247+ }
248+ }
249+ ` ,
250+ parserOptions,
251+ errors : [ {
252+ message : 'Prop "greeting_text" is not in camelCase.' ,
253+ type : 'Property' ,
254+ line : 4
255+ } ]
256+ } ,
257+ {
258+ // computed property name
259+ filename : 'test.vue' ,
260+ code : `
261+ export default {
262+ props: {
263+ ['greeting-text']: String
264+ }
265+ }
266+ ` ,
267+ output : null ,
268+ parserOptions,
269+ errors : [ {
270+ message : 'Prop "greeting-text" is not in camelCase.' ,
271+ type : 'Property' ,
272+ line : 4
273+ } ]
274+ } ,
275+ {
276+ // shorthand
277+ filename : 'test.vue' ,
278+ code : `
279+ export default {
280+ props: {
281+ greeting_text
282+ }
283+ }
284+ ` ,
285+ output : null ,
286+ parserOptions,
287+ errors : [ {
288+ message : 'Prop "greeting_text" is not in camelCase.' ,
289+ type : 'Property' ,
290+ line : 4
291+ } ]
292+ } ,
293+ {
294+ // valiable computed property name
295+ filename : 'test.vue' ,
296+ code : `
297+ export default {
298+ props: {
299+ [greeting_text]: String
300+ }
301+ }
302+ ` ,
303+ output : null ,
304+ parserOptions,
305+ errors : [ {
306+ // bug ?
307+ message : 'Prop "greeting_text" is not in camelCase.' ,
308+ type : 'Property' ,
309+ line : 4
310+ } ]
311+ } ,
312+ {
313+ // emoji
314+ filename : 'test.vue' ,
315+ code : `
316+ export default {
317+ props: {
318+ '\u{1F37B}': String
319+ }
320+ }
321+ ` ,
322+ output : null ,
323+ parserOptions,
324+ errors : [ {
325+ message : 'Prop "\u{1F37B}" is not in camelCase.' ,
326+ type : 'Property' ,
327+ line : 4
328+ } ]
329+ } ,
330+ {
331+ // Japanese characters
332+ filename : 'test.vue' ,
333+ code : `
334+ export default {
335+ props: {
336+ '漢字': String
337+ }
338+ }
339+ ` ,
340+ output : null ,
341+ parserOptions,
342+ errors : [ {
343+ message : 'Prop "漢字" is not in camelCase.' ,
344+ type : 'Property' ,
345+ line : 4
346+ } ]
347+ } ,
348+ {
349+ filename : 'test.vue' ,
350+ code : `
351+ export default {
352+ props: {
353+ 'abc-123-def': String
354+ }
355+ }
356+ ` ,
357+ output : `
358+ export default {
359+ props: {
360+ 'abc123Def': String
361+ }
362+ }
363+ ` ,
364+ parserOptions,
365+ errors : [ {
366+ message : 'Prop "abc-123-def" is not in camelCase.' ,
367+ type : 'Property' ,
368+ line : 4
369+ } ]
198370 }
199371 ]
200372} )
0 commit comments