@@ -153,24 +153,19 @@ tester.run('no-negated-v-if-condition', rule, {
153153 <span v-else class="secondary">Alternative</span>
154154 </template>
155155 ` ,
156+ output : `
157+ <template>
158+ <span v-if="foo" class="secondary">Alternative</span>
159+ <div v-else class="primary">Content</div>
160+ </template>
161+ ` ,
156162 errors : [
157163 {
158164 messageId : 'negatedCondition' ,
159165 line : 3 ,
160166 column : 20 ,
161167 endLine : 3 ,
162- endColumn : 24 ,
163- suggestions : [
164- {
165- messageId : 'fixNegatedCondition' ,
166- output : `
167- <template>
168- <span v-if="foo" class="secondary">Alternative</span>
169- <div v-else class="primary">Content</div>
170- </template>
171- `
172- }
173- ]
168+ endColumn : 24
174169 }
175170 ]
176171 } ,
@@ -182,24 +177,19 @@ tester.run('no-negated-v-if-condition', rule, {
182177 <span v-else id="positive">Otherwise</span>
183178 </template>
184179 ` ,
180+ output : `
181+ <template>
182+ <span v-if="(foo && bar)" id="positive">Otherwise</span>
183+ <div v-else id="negated">Negated condition</div>
184+ </template>
185+ ` ,
185186 errors : [
186187 {
187188 messageId : 'negatedCondition' ,
188189 line : 3 ,
189190 column : 20 ,
190191 endLine : 3 ,
191- endColumn : 33 ,
192- suggestions : [
193- {
194- messageId : 'fixNegatedCondition' ,
195- output : `
196- <template>
197- <span v-if="(foo && bar)" id="positive">Otherwise</span>
198- <div v-else id="negated">Negated condition</div>
199- </template>
200- `
201- }
202- ]
192+ endColumn : 33
203193 }
204194 ]
205195 } ,
@@ -211,24 +201,19 @@ tester.run('no-negated-v-if-condition', rule, {
211201 <div v-else>Equal</div>
212202 </template>
213203 ` ,
204+ output : `
205+ <template>
206+ <div v-if="a == b">Equal</div>
207+ <div v-else>Not equal</div>
208+ </template>
209+ ` ,
214210 errors : [
215211 {
216212 messageId : 'negatedCondition' ,
217213 line : 3 ,
218214 column : 20 ,
219215 endLine : 3 ,
220- endColumn : 26 ,
221- suggestions : [
222- {
223- messageId : 'fixNegatedCondition' ,
224- output : `
225- <template>
226- <div v-if="a == b">Equal</div>
227- <div v-else>Not equal</div>
228- </template>
229- `
230- }
231- ]
216+ endColumn : 26
232217 }
233218 ]
234219 } ,
@@ -240,24 +225,19 @@ tester.run('no-negated-v-if-condition', rule, {
240225 <div v-else>Strictly equal</div>
241226 </template>
242227 ` ,
228+ output : `
229+ <template>
230+ <div v-if="a === b">Strictly equal</div>
231+ <div v-else>Strictly not equal</div>
232+ </template>
233+ ` ,
243234 errors : [
244235 {
245236 messageId : 'negatedCondition' ,
246237 line : 3 ,
247238 column : 20 ,
248239 endLine : 3 ,
249- endColumn : 27 ,
250- suggestions : [
251- {
252- messageId : 'fixNegatedCondition' ,
253- output : `
254- <template>
255- <div v-if="a === b">Strictly equal</div>
256- <div v-else>Strictly not equal</div>
257- </template>
258- `
259- }
260- ]
240+ endColumn : 27
261241 }
262242 ]
263243 } ,
@@ -270,25 +250,20 @@ tester.run('no-negated-v-if-condition', rule, {
270250 <p v-else class="default">Default</p>
271251 </template>
272252 ` ,
253+ output : `
254+ <template>
255+ <div v-if="foo" class="first">First</div>
256+ <p v-else-if="bar" class="default">Default</p>
257+ <span v-else class="second">Second</span>
258+ </template>
259+ ` ,
273260 errors : [
274261 {
275262 messageId : 'negatedCondition' ,
276263 line : 4 ,
277264 column : 26 ,
278265 endLine : 4 ,
279- endColumn : 30 ,
280- suggestions : [
281- {
282- messageId : 'fixNegatedCondition' ,
283- output : `
284- <template>
285- <div v-if="foo" class="first">First</div>
286- <p v-else-if="bar" class="default">Default</p>
287- <span v-else class="second">Second</span>
288- </template>
289- `
290- }
291- ]
266+ endColumn : 30
292267 }
293268 ]
294269 } ,
@@ -301,25 +276,20 @@ tester.run('no-negated-v-if-condition', rule, {
301276 <p v-else data-default>Default</p>
302277 </template>
303278 ` ,
279+ output : `
280+ <template>
281+ <div v-if="!a" data-first>First</div>
282+ <p v-else-if="b" data-default>Default</p>
283+ <span v-else data-second>Second</span>
284+ </template>
285+ ` ,
304286 errors : [
305287 {
306288 messageId : 'negatedCondition' ,
307289 line : 4 ,
308290 column : 26 ,
309291 endLine : 4 ,
310- endColumn : 28 ,
311- suggestions : [
312- {
313- messageId : 'fixNegatedCondition' ,
314- output : `
315- <template>
316- <div v-if="!a" data-first>First</div>
317- <p v-else-if="b" data-default>Default</p>
318- <span v-else data-second>Second</span>
319- </template>
320- `
321- }
322- ]
292+ endColumn : 28
323293 }
324294 ]
325295 } ,
@@ -331,24 +301,19 @@ tester.run('no-negated-v-if-condition', rule, {
331301 <span v-else class="span-class" span-attr="baz" span-attr2 :span-attr-3="baz">span contents</span>
332302 </template>
333303 ` ,
304+ output : `
305+ <template>
306+ <span v-if="condition" class="span-class" span-attr="baz" span-attr2 :span-attr-3="baz">span contents</span>
307+ <div v-else class="div-class" div-attr="foo" div-attr-2 :div-attr-3="foo">div contents</div>
308+ </template>
309+ ` ,
334310 errors : [
335311 {
336312 messageId : 'negatedCondition' ,
337313 line : 3 ,
338314 column : 20 ,
339315 endLine : 3 ,
340- endColumn : 30 ,
341- suggestions : [
342- {
343- messageId : 'fixNegatedCondition' ,
344- output : `
345- <template>
346- <span v-if="condition" class="span-class" span-attr="baz" span-attr2 :span-attr-3="baz">span contents</span>
347- <div v-else class="div-class" div-attr="foo" div-attr-2 :div-attr-3="foo">div contents</div>
348- </template>
349- `
350- }
351- ]
316+ endColumn : 30
352317 }
353318 ]
354319 } ,
@@ -366,17 +331,7 @@ tester.run('no-negated-v-if-condition', rule, {
366331 </section>
367332 </template>
368333 ` ,
369- errors : [
370- {
371- messageId : 'negatedCondition' ,
372- line : 3 ,
373- column : 20 ,
374- endLine : 3 ,
375- endColumn : 26 ,
376- suggestions : [
377- {
378- messageId : 'fixNegatedCondition' ,
379- output : `
334+ output : `
380335 <template>
381336 <section v-if="outer" class="outer-else">
382337 <span v-if="!nested" class="nested-if">Nested if content</span>
@@ -387,57 +342,28 @@ tester.run('no-negated-v-if-condition', rule, {
387342 <p v-else class="inner-else">Inner else content</p>
388343 </div>
389344 </template>
390- `
391- }
392- ]
345+ ` ,
346+ errors : [
347+ {
348+ messageId : 'negatedCondition' ,
349+ line : 3 ,
350+ column : 20 ,
351+ endLine : 3 ,
352+ endColumn : 26
393353 } ,
394354 {
395355 messageId : 'negatedCondition' ,
396356 line : 4 ,
397357 column : 23 ,
398358 endLine : 4 ,
399- endColumn : 29 ,
400- suggestions : [
401- {
402- messageId : 'fixNegatedCondition' ,
403- output : `
404- <template>
405- <div v-if="!outer" class="outer-if">
406- <p v-if="inner" class="inner-else">Inner else content</p>
407- <span v-else class="inner-if">Inner if content</span>
408- </div>
409- <section v-else class="outer-else">
410- <span v-if="!nested" class="nested-if">Nested if content</span>
411- <p v-else class="nested-else">Nested else content</p>
412- </section>
413- </template>
414- `
415- }
416- ]
359+ endColumn : 29
417360 } ,
418361 {
419362 messageId : 'negatedCondition' ,
420363 line : 8 ,
421364 column : 23 ,
422365 endLine : 8 ,
423- endColumn : 30 ,
424- suggestions : [
425- {
426- messageId : 'fixNegatedCondition' ,
427- output : `
428- <template>
429- <div v-if="!outer" class="outer-if">
430- <span v-if="!inner" class="inner-if">Inner if content</span>
431- <p v-else class="inner-else">Inner else content</p>
432- </div>
433- <section v-else class="outer-else">
434- <p v-if="nested" class="nested-else">Nested else content</p>
435- <span v-else class="nested-if">Nested if content</span>
436- </section>
437- </template>
438- `
439- }
440- ]
366+ endColumn : 30
441367 }
442368 ]
443369 }
0 commit comments