@@ -91,17 +91,53 @@ ruleTester.run('max-attributes-per-line', rule, {
91
91
invalid : [
92
92
{
93
93
code : `<template><component name="John Doe" age="30"></component></template>` ,
94
- output : `<template><component name="John Doe"
94
+ output : `<template><component name="John Doe"
95
95
age="30"></component></template>` ,
96
96
errors : [ 'Attribute "age" should be on a new line.' ]
97
97
} ,
98
+ {
99
+ code : `<template><component :name="user.name" :age="user.age"></component></template>` ,
100
+ output : `<template><component :name="user.name"
101
+ :age="user.age"></component></template>` ,
102
+ errors : [ 'Binding "age" should be on a new line.' ]
103
+ } ,
104
+ {
105
+ code : `<template><component :is="test" v-bind="user"></component></template>` ,
106
+ output : `<template><component :is="test"
107
+ v-bind="user"></component></template>` ,
108
+ errors : [ 'Directive "bind" should be on a new line.' ]
109
+ } ,
110
+ {
111
+ code : `<template><component :name="user.name" @buy="buyProduct"></component></template>` ,
112
+ output : `<template><component :name="user.name"
113
+ @buy="buyProduct"></component></template>` ,
114
+ errors : [ 'Event "buy" should be on a new line.' ]
115
+ } ,
116
+ {
117
+ code : `<template><component :name="user.name" @click.stop></component></template>` ,
118
+ output : `<template><component :name="user.name"
119
+ @click.stop></component></template>` ,
120
+ errors : [ 'Event "click" should be on a new line.' ]
121
+ } ,
122
+ {
123
+ code : `<template><component :name="user.name" v-if="something"></component></template>` ,
124
+ output : `<template><component :name="user.name"
125
+ v-if="something"></component></template>` ,
126
+ errors : [ 'Directive "if" should be on a new line.' ]
127
+ } ,
128
+ {
129
+ code : `<template><component name="John Doe" v-bind:age="user.age"></component></template>` ,
130
+ output : `<template><component name="John Doe"
131
+ v-bind:age="user.age"></component></template>` ,
132
+ errors : [ 'Binding "age" should be on a new line.' ]
133
+ } ,
98
134
{
99
135
code : `<template><component job="Vet"
100
136
name="John Doe"
101
137
age="30">
102
138
</component>
103
139
</template>` ,
104
- output : `<template><component
140
+ output : `<template><component
105
141
job="Vet"
106
142
name="John Doe"
107
143
age="30">
@@ -116,7 +152,7 @@ job="Vet"
116
152
{
117
153
code : `<template><component name="John Doe" age="30" job="Vet"></component></template>` ,
118
154
options : [ { singleline : { max : 2 } } ] ,
119
- output : `<template><component name="John Doe" age="30"
155
+ output : `<template><component name="John Doe" age="30"
120
156
job="Vet"></component></template>` ,
121
157
errors : [ {
122
158
message : 'Attribute "job" should be on a new line.' ,
@@ -127,7 +163,7 @@ job="Vet"></component></template>`,
127
163
{
128
164
code : `<template><component name="John Doe" age="30" job="Vet"></component></template>` ,
129
165
options : [ { singleline : 1 , multiline : { max : 1 , allowFirstLine : false } } ] ,
130
- output : `<template><component name="John Doe"
166
+ output : `<template><component name="John Doe"
131
167
age="30" job="Vet"></component></template>` ,
132
168
errors : [ {
133
169
message : 'Attribute "age" should be on a new line.' ,
@@ -145,7 +181,7 @@ age="30" job="Vet"></component></template>`,
145
181
</component>
146
182
</template>` ,
147
183
options : [ { singleline : 3 , multiline : { max : 1 , allowFirstLine : false } } ] ,
148
- output : `<template><component
184
+ output : `<template><component
149
185
name="John Doe"
150
186
age="30">
151
187
</component>
@@ -164,7 +200,7 @@ name="John Doe"
164
200
</template>` ,
165
201
options : [ { singleline : 3 , multiline : { max : 1 , allowFirstLine : false } } ] ,
166
202
output : `<template><component
167
- name="John Doe"
203
+ name="John Doe"
168
204
age="30"
169
205
job="Vet">
170
206
</component>
@@ -183,7 +219,7 @@ age="30"
183
219
</template>` ,
184
220
options : [ { singleline : 3 , multiline : 1 } ] ,
185
221
output : `<template><component
186
- name="John Doe"
222
+ name="John Doe"
187
223
age="30"
188
224
job="Vet">
189
225
</component>
@@ -203,7 +239,7 @@ age="30"
203
239
options : [ { singleline : 3 , multiline : { max : 2 , allowFirstLine : false } } ] ,
204
240
output : `<template><component
205
241
name="John Doe" age="30"
206
- job="Vet" pet="dog"
242
+ job="Vet" pet="dog"
207
243
petname="Snoopy">
208
244
</component>
209
245
</template>` ,
@@ -222,7 +258,7 @@ petname="Snoopy">
222
258
options : [ { singleline : 3 , multiline : { max : 2 , allowFirstLine : false } } ] ,
223
259
output : `<template><component
224
260
name="John Doe" age="30"
225
- job="Vet" pet="dog"
261
+ job="Vet" pet="dog"
226
262
petname="Snoopy" extra="foo">
227
263
</component>
228
264
</template>` ,
0 commit comments