Skip to content

Commit 4eb1492

Browse files
authored
test(multiline-html-element-content-newline): make tests more strict (#2852)
1 parent 9ca4903 commit 4eb1492

File tree

1 file changed

+240
-30
lines changed

1 file changed

+240
-30
lines changed

tests/lib/rules/multiline-html-element-content-newline.js

Lines changed: 240 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,22 @@ multiline
384384
</div>
385385
</template>`,
386386
errors: [
387-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
388-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
387+
{
388+
message:
389+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
390+
line: 3,
391+
column: 16,
392+
endLine: 3,
393+
endColumn: 16
394+
},
395+
{
396+
message:
397+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
398+
line: 4,
399+
column: 20,
400+
endLine: 4,
401+
endColumn: 20
402+
}
389403
]
390404
},
391405
{
@@ -401,7 +415,14 @@ multiline content
401415
</div>
402416
</template>`,
403417
errors: [
404-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.'
418+
{
419+
message:
420+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
421+
line: 3,
422+
column: 16,
423+
endLine: 3,
424+
endColumn: 16
425+
}
405426
]
406427
},
407428
{
@@ -417,7 +438,14 @@ multiline content
417438
</div>
418439
</template>`,
419440
errors: [
420-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
441+
{
442+
message:
443+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
444+
line: 4,
445+
column: 30,
446+
endLine: 4,
447+
endColumn: 30
448+
}
421449
]
422450
},
423451
// comments
@@ -437,8 +465,22 @@ multiline content
437465
</template>
438466
`,
439467
errors: [
440-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
441-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
468+
{
469+
message:
470+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
471+
line: 3,
472+
column: 16,
473+
endLine: 3,
474+
endColumn: 16
475+
},
476+
{
477+
message:
478+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
479+
line: 4,
480+
column: 25,
481+
endLine: 4,
482+
endColumn: 25
483+
}
442484
]
443485
},
444486
{
@@ -457,8 +499,22 @@ multiline content
457499
</template>
458500
`,
459501
errors: [
460-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
461-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
502+
{
503+
message:
504+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
505+
line: 3,
506+
column: 16,
507+
endLine: 3,
508+
endColumn: 16
509+
},
510+
{
511+
message:
512+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
513+
line: 4,
514+
column: 23,
515+
endLine: 4,
516+
endColumn: 23
517+
}
462518
]
463519
},
464520
// one error
@@ -479,7 +535,14 @@ content
479535
</template>
480536
`,
481537
errors: [
482-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.'
538+
{
539+
message:
540+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
541+
line: 3,
542+
column: 16,
543+
endLine: 3,
544+
endColumn: 16
545+
}
483546
]
484547
},
485548
{
@@ -499,7 +562,14 @@ content
499562
</template>
500563
`,
501564
errors: [
502-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
565+
{
566+
message:
567+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
568+
line: 5,
569+
column: 18,
570+
endLine: 5,
571+
endColumn: 18
572+
}
503573
]
504574
},
505575
// multi
@@ -519,12 +589,54 @@ content
519589
</template>
520590
`,
521591
errors: [
522-
'Expected 1 line break after opening tag (`<template>`), but no line breaks found.',
523-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
524-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
525-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
526-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
527-
'Expected 1 line break before closing tag (`</template>`), but no line breaks found.'
592+
{
593+
message:
594+
'Expected 1 line break after opening tag (`<template>`), but no line breaks found.',
595+
line: 2,
596+
column: 19,
597+
endLine: 2,
598+
endColumn: 19
599+
},
600+
{
601+
message:
602+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
603+
line: 2,
604+
column: 24,
605+
endLine: 2,
606+
endColumn: 24
607+
},
608+
{
609+
message:
610+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
611+
line: 2,
612+
column: 36,
613+
endLine: 2,
614+
endColumn: 36
615+
},
616+
{
617+
message:
618+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
619+
line: 3,
620+
column: 16,
621+
endLine: 3,
622+
endColumn: 16
623+
},
624+
{
625+
message:
626+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
627+
line: 3,
628+
column: 29,
629+
endLine: 3,
630+
endColumn: 29
631+
},
632+
{
633+
message:
634+
'Expected 1 line break before closing tag (`</template>`), but no line breaks found.',
635+
line: 3,
636+
column: 35,
637+
endLine: 3,
638+
endColumn: 35
639+
}
528640
]
529641
},
530642
// multi line breaks
@@ -548,8 +660,22 @@ content
548660
</template>
549661
`,
550662
errors: [
551-
'Expected 1 line break after opening tag (`<div>`), but 2 line breaks found.',
552-
'Expected 1 line break before closing tag (`</div>`), but 2 line breaks found.'
663+
{
664+
message:
665+
'Expected 1 line break after opening tag (`<div>`), but 2 line breaks found.',
666+
line: 3,
667+
column: 16,
668+
endLine: 5,
669+
endColumn: 13
670+
},
671+
{
672+
message:
673+
'Expected 1 line break before closing tag (`</div>`), but 2 line breaks found.',
674+
line: 6,
675+
column: 20,
676+
endLine: 8,
677+
endColumn: 11
678+
}
553679
]
554680
},
555681
// allowEmptyLines
@@ -575,7 +701,14 @@ content
575701
</template>`,
576702
options: [{ allowEmptyLines: true, ignoreWhenEmpty: false }],
577703
errors: [
578-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.'
704+
{
705+
message:
706+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
707+
line: 8,
708+
column: 27,
709+
endLine: 8,
710+
endColumn: 27
711+
}
579712
]
580713
},
581714
{
@@ -607,8 +740,22 @@ content
607740
`,
608741
options: [{ allowEmptyLines: true }],
609742
errors: [
610-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
611-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
743+
{
744+
message:
745+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
746+
line: 9,
747+
column: 16,
748+
endLine: 9,
749+
endColumn: 16
750+
},
751+
{
752+
message:
753+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
754+
line: 10,
755+
column: 20,
756+
endLine: 10,
757+
endColumn: 20
758+
}
612759
]
613760
},
614761
// mustache
@@ -628,8 +775,22 @@ content
628775
</template>
629776
`,
630777
errors: [
631-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
632-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
778+
{
779+
message:
780+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
781+
line: 3,
782+
column: 16,
783+
endLine: 3,
784+
endColumn: 16
785+
},
786+
{
787+
message:
788+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
789+
line: 4,
790+
column: 23,
791+
endLine: 4,
792+
endColumn: 23
793+
}
633794
]
634795
},
635796
// mix
@@ -651,8 +812,22 @@ content
651812
</template>
652813
`,
653814
errors: [
654-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
655-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
815+
{
816+
message:
817+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
818+
line: 3,
819+
column: 16,
820+
endLine: 3,
821+
endColumn: 16
822+
},
823+
{
824+
message:
825+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
826+
line: 5,
827+
column: 27,
828+
endLine: 5,
829+
endColumn: 27
830+
}
656831
]
657832
},
658833
// start tag
@@ -672,8 +847,22 @@ content
672847
</template>
673848
`,
674849
errors: [
675-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
676-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
850+
{
851+
message:
852+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
853+
line: 4,
854+
column: 14,
855+
endLine: 4,
856+
endColumn: 14
857+
},
858+
{
859+
message:
860+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
861+
line: 4,
862+
column: 21,
863+
endLine: 4,
864+
endColumn: 21
865+
}
677866
]
678867
},
679868
{
@@ -692,8 +881,22 @@ content
692881
</template>
693882
`,
694883
errors: [
695-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
696-
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.'
884+
{
885+
message:
886+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
887+
line: 4,
888+
column: 18,
889+
endLine: 4,
890+
endColumn: 18
891+
},
892+
{
893+
message:
894+
'Expected 1 line break before closing tag (`</div>`), but no line breaks found.',
895+
line: 4,
896+
column: 25,
897+
endLine: 4,
898+
endColumn: 25
899+
}
697900
]
698901
},
699902
{
@@ -712,7 +915,14 @@ content
712915
`,
713916
options: [{ ignoreWhenEmpty: false }],
714917
errors: [
715-
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.'
918+
{
919+
message:
920+
'Expected 1 line break after opening tag (`<div>`), but no line breaks found.',
921+
line: 4,
922+
column: 14,
923+
endLine: 4,
924+
endColumn: 14
925+
}
716926
]
717927
}
718928
]

0 commit comments

Comments
 (0)