@@ -45,8 +45,8 @@ ruleTester.run('attribute-hyphenation', rule, {
4545 } ,
4646 {
4747 filename : 'test.vue' ,
48- code : '<template><div data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hypen ="foo"><a onClick="" my-prop="prop"></a></div ></template>' ,
49- options : [ 'never' , { 'ignore' : [ 'custom-hypen ' ] } ]
48+ code : '<template><custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hyphen ="foo" second-custom="bar" ><a onClick="" my-prop="prop"></a></custom ></template>' ,
49+ options : [ 'never' , { 'ignore' : [ 'custom-hyphen' , 'second-custom '] } ]
5050 }
5151 ] ,
5252
@@ -57,7 +57,7 @@ ruleTester.run('attribute-hyphenation', rule, {
5757 output : '<template><div><custom myProp="foo"></custom></div></template>' ,
5858 options : [ 'never' ] ,
5959 errors : [ {
60- message : "Attribute 'my-prop' cann 't be hyphenated." ,
60+ message : "Attribute 'my-prop' can 't be hyphenated." ,
6161 type : 'VIdentifier' ,
6262 line : 1
6363 } ]
@@ -79,7 +79,7 @@ ruleTester.run('attribute-hyphenation', rule, {
7979 output : '<template><div><custom :myProp="prop"></custom></div></template>' ,
8080 options : [ 'never' ] ,
8181 errors : [ {
82- message : "Attribute ':my-prop' cann 't be hyphenated." ,
82+ message : "Attribute ':my-prop' can 't be hyphenated." ,
8383 type : 'VDirectiveKey' ,
8484 line : 1
8585 } ]
@@ -101,7 +101,7 @@ ruleTester.run('attribute-hyphenation', rule, {
101101 output : '<template><div><custom v-bind:myProp="prop"></custom></div></template>' ,
102102 options : [ 'never' ] ,
103103 errors : [ {
104- message : "Attribute 'v-bind:my-prop' cann 't be hyphenated." ,
104+ message : "Attribute 'v-bind:my-prop' can 't be hyphenated." ,
105105 type : 'VDirectiveKey' ,
106106 line : 1
107107 } ]
@@ -116,6 +116,89 @@ ruleTester.run('attribute-hyphenation', rule, {
116116 type : 'VDirectiveKey' ,
117117 line : 1
118118 } ]
119+ } ,
120+ {
121+ filename : 'test.vue' ,
122+ code : '<template><div><custom v-bind:MyProp="prop"></custom></div></template>' ,
123+ output : '<template><div><custom v-bind:my-prop="prop"></custom></div></template>' ,
124+ options : [ 'always' , { 'ignore' : [ ] } ] ,
125+ errors : [ {
126+ message : "Attribute 'v-bind:MyProp' must be hyphenated." ,
127+ type : 'VDirectiveKey' ,
128+ line : 1
129+ } ]
130+ } ,
131+ {
132+ filename : 'test.vue' ,
133+ code : '<template><div><custom v-bind:my-prop="prop" :second-prop="test"></custom></div></template>' ,
134+ output : '<template><div><custom v-bind:my-prop="prop" :secondProp="test"></custom></div></template>' ,
135+ options : [ 'never' , { ignore : [ 'my-prop' ] } ] ,
136+ errors : [ {
137+ message : "Attribute ':second-prop' can't be hyphenated." ,
138+ type : 'VDirectiveKey' ,
139+ line : 1
140+ } ]
141+ } ,
142+ {
143+ filename : 'test.vue' ,
144+ code : '<template><div><custom v-bind:myProp="prop" :secondProp="test"></custom></div></template>' ,
145+ output : '<template><div><custom v-bind:my-prop="prop" :secondProp="test"></custom></div></template>' ,
146+ options : [ 'always' , { ignore : [ 'secondProp' ] } ] ,
147+ errors : [ {
148+ message : "Attribute 'v-bind:myProp' must be hyphenated." ,
149+ type : 'VDirectiveKey' ,
150+ line : 1
151+ } ]
152+ } ,
153+ {
154+ filename : 'test.vue' ,
155+ code : `
156+ <template>
157+ <custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hyphen="foo" second-custom="baz" third-custom="bar">
158+ <a onClick="" my-prop="prop"></a>
159+ </custom>
160+ </template>
161+ ` ,
162+ output : `
163+ <template>
164+ <custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hyphen="foo" second-custom="baz" thirdCustom="bar">
165+ <a onClick="" my-prop="prop"></a>
166+ </custom>
167+ </template>
168+ ` ,
169+ options : [ 'never' , { 'ignore' : [ 'custom-hyphen' , 'second-custom' ] } ] ,
170+ errors : [ {
171+ message : "Attribute 'third-custom' can't be hyphenated." ,
172+ type : 'VIdentifier' ,
173+ line : 3
174+ } ]
175+ } ,
176+ {
177+ filename : 'test.vue' ,
178+ code : `
179+ <template>
180+ <custom data-id="foo" aria-test="bar" slot-scope="{ data }" custom-hyphen="foo" second-custom="baz" thirdCustom="bar">
181+ <a onClick="" my-prop="prop"></a>
182+ </custom>
183+ </template>
184+ ` ,
185+ output : `
186+ <template>
187+ <custom data-id="foo" aria-test="bar" slot-scope="{ data }" customHyphen="foo" secondCustom="baz" thirdCustom="bar">
188+ <a onClick="" my-prop="prop"></a>
189+ </custom>
190+ </template>
191+ ` ,
192+ options : [ 'never' ] ,
193+ errors : [ {
194+ message : "Attribute 'custom-hyphen' can't be hyphenated." ,
195+ type : 'VIdentifier' ,
196+ line : 3
197+ } , {
198+ message : "Attribute 'second-custom' can't be hyphenated." ,
199+ type : 'VIdentifier' ,
200+ line : 3
201+ } ]
119202 }
120203 ]
121204} )
0 commit comments