@@ -91,17 +91,53 @@ ruleTester.run('max-attributes-per-line', rule, {
9191 invalid : [
9292 {
9393 code : `<template><component name="John Doe" age="30"></component></template>` ,
94- output : `<template><component name="John Doe"
94+ output : `<template><component name="John Doe"
9595age="30"></component></template>` ,
9696 errors : [ 'Attribute "age" should be on a new line.' ]
9797 } ,
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+ } ,
98134 {
99135 code : `<template><component job="Vet"
100136 name="John Doe"
101137 age="30">
102138 </component>
103139 </template>` ,
104- output : `<template><component
140+ output : `<template><component
105141job="Vet"
106142 name="John Doe"
107143 age="30">
@@ -116,7 +152,7 @@ job="Vet"
116152 {
117153 code : `<template><component name="John Doe" age="30" job="Vet"></component></template>` ,
118154 options : [ { singleline : { max : 2 } } ] ,
119- output : `<template><component name="John Doe" age="30"
155+ output : `<template><component name="John Doe" age="30"
120156job="Vet"></component></template>` ,
121157 errors : [ {
122158 message : 'Attribute "job" should be on a new line.' ,
@@ -127,7 +163,7 @@ job="Vet"></component></template>`,
127163 {
128164 code : `<template><component name="John Doe" age="30" job="Vet"></component></template>` ,
129165 options : [ { singleline : 1 , multiline : { max : 1 , allowFirstLine : false } } ] ,
130- output : `<template><component name="John Doe"
166+ output : `<template><component name="John Doe"
131167age="30" job="Vet"></component></template>` ,
132168 errors : [ {
133169 message : 'Attribute "age" should be on a new line.' ,
@@ -145,7 +181,7 @@ age="30" job="Vet"></component></template>`,
145181 </component>
146182 </template>` ,
147183 options : [ { singleline : 3 , multiline : { max : 1 , allowFirstLine : false } } ] ,
148- output : `<template><component
184+ output : `<template><component
149185name="John Doe"
150186 age="30">
151187 </component>
@@ -164,7 +200,7 @@ name="John Doe"
164200 </template>` ,
165201 options : [ { singleline : 3 , multiline : { max : 1 , allowFirstLine : false } } ] ,
166202 output : `<template><component
167- name="John Doe"
203+ name="John Doe"
168204age="30"
169205 job="Vet">
170206 </component>
@@ -183,7 +219,7 @@ age="30"
183219 </template>` ,
184220 options : [ { singleline : 3 , multiline : 1 } ] ,
185221 output : `<template><component
186- name="John Doe"
222+ name="John Doe"
187223age="30"
188224 job="Vet">
189225 </component>
@@ -203,7 +239,7 @@ age="30"
203239 options : [ { singleline : 3 , multiline : { max : 2 , allowFirstLine : false } } ] ,
204240 output : `<template><component
205241 name="John Doe" age="30"
206- job="Vet" pet="dog"
242+ job="Vet" pet="dog"
207243petname="Snoopy">
208244 </component>
209245 </template>` ,
@@ -222,7 +258,7 @@ petname="Snoopy">
222258 options : [ { singleline : 3 , multiline : { max : 2 , allowFirstLine : false } } ] ,
223259 output : `<template><component
224260 name="John Doe" age="30"
225- job="Vet" pet="dog"
261+ job="Vet" pet="dog"
226262petname="Snoopy" extra="foo">
227263 </component>
228264 </template>` ,
0 commit comments