@@ -56,6 +56,12 @@ ruleTester.run('jsx-max-elements-per-line', rule, {
56
56
' <Foo></Foo>' ,
57
57
'</App>'
58
58
] . join ( '\n' )
59
+ } , {
60
+ code : [
61
+ '<App>' ,
62
+ ' foo bar baz whatever ' ,
63
+ '</App>'
64
+ ] . join ( '\n' )
59
65
} , {
60
66
code : [
61
67
'<App>' ,
@@ -102,17 +108,115 @@ ruleTester.run('jsx-max-elements-per-line', rule, {
102
108
} , {
103
109
code : [
104
110
'<div>' ,
105
- ' <span />foo<input /> ' ,
111
+ ' <span />foo' ,
106
112
'</div>'
107
113
] . join ( '\n' ) ,
108
114
output : [
109
115
'<div>' ,
110
- ' <span />foo' ,
116
+ ' <span />' ,
117
+ 'foo' ,
118
+ '</div>'
119
+ ] . join ( '\n' ) ,
120
+ errors : [ { message : 'Literal `foo` must be placed on a new line' } ] ,
121
+ parserOptions : parserOptions
122
+ } , {
123
+ code : [
124
+ '<div>' ,
125
+ ' <span />{"foo"}' ,
126
+ '</div>'
127
+ ] . join ( '\n' ) ,
128
+ output : [
129
+ '<div>' ,
130
+ ' <span />' ,
131
+ '{"foo"}' ,
132
+ '</div>'
133
+ ] . join ( '\n' ) ,
134
+ errors : [ { message : 'Literal `{"foo"}` must be placed on a new line' } ] , // TODO: Replace `Literal` with proper term.
135
+ parserOptions : parserOptions
136
+ } , {
137
+ code : [
138
+ '<div>' ,
139
+ ' foo<input />' ,
140
+ '</div>'
141
+ ] . join ( '\n' ) ,
142
+ output : [
143
+ '<div>' ,
144
+ ' foo' ,
111
145
'<input />' ,
112
146
'</div>'
113
147
] . join ( '\n' ) ,
114
148
errors : [ { message : 'Opening tag for Element `input` must be placed on a new line' } ] ,
115
149
parserOptions : parserOptions
150
+ } , {
151
+ code : [
152
+ '<div>' ,
153
+ ' {"foo"}<span />' ,
154
+ '</div>'
155
+ ] . join ( '\n' ) ,
156
+ output : [
157
+ '<div>' ,
158
+ ' {"foo"}' ,
159
+ '<span />' ,
160
+ '</div>'
161
+ ] . join ( '\n' ) ,
162
+ errors : [ { message : 'Opening tag for Element `span` must be placed on a new line' } ] ,
163
+ parserOptions : parserOptions
164
+ } , {
165
+ code : [
166
+ '<div>' ,
167
+ ' foo <input />' ,
168
+ '</div>'
169
+ ] . join ( '\n' ) ,
170
+ errors : [ { message : 'Opening tag for Element `input` must be placed on a new line' } ] ,
171
+ parserOptions : parserOptions
172
+ } , {
173
+ code : [
174
+ '<div>' ,
175
+ ' <span /> <input />' ,
176
+ '</div>'
177
+ ] . join ( '\n' ) ,
178
+ errors : [ { message : 'Opening tag for Element `input` must be placed on a new line' } ] ,
179
+ parserOptions : parserOptions
180
+ } , {
181
+ code : [
182
+ '<div>' ,
183
+ ' <input /> foo' ,
184
+ '</div>'
185
+ ] . join ( '\n' ) ,
186
+ errors : [ { message : 'Literal ` foo` must be placed on a new line' } ] ,
187
+ parserOptions : parserOptions
188
+ } , {
189
+ code : [
190
+ '<div>' ,
191
+ ' {"foo"} <input />' ,
192
+ '</div>'
193
+ ] . join ( '\n' ) ,
194
+ errors : [ { message : 'Opening tag for Element `input` must be placed on a new line' } ] ,
195
+ parserOptions : parserOptions
196
+ } , {
197
+ code : [
198
+ '<div>' ,
199
+ ' {"foo"} bar' ,
200
+ '</div>'
201
+ ] . join ( '\n' ) ,
202
+ errors : [ { message : 'Literal `bar` must be placed on a new line' } ] ,
203
+ parserOptions : parserOptions
204
+ } , {
205
+ code : [
206
+ '<div>' ,
207
+ ' foo {"bar"}' ,
208
+ '</div>'
209
+ ] . join ( '\n' ) ,
210
+ errors : [ { message : 'Literal `{"bar"}` must be placed on a new line' } ] , // TODO: Replace `Literal` with proper term.
211
+ parserOptions : parserOptions
212
+ } , {
213
+ code : [
214
+ '<div>' ,
215
+ ' <input /> {"foo"}' ,
216
+ '</div>'
217
+ ] . join ( '\n' ) ,
218
+ errors : [ { message : 'Literal `{"foo"}` must be placed on a new line' } ] , // TODO: Replace `Literal` with proper term.
219
+ parserOptions : parserOptions
116
220
} , {
117
221
code : [
118
222
'<App>' ,
0 commit comments