@@ -57,11 +57,46 @@ tester.run('html-self-closing-style', rule, {
5757 '<template><img></template>' ,
5858 '<template><x-test/></template>' ,
5959 '<template><svg><path/></svg></template>' ,
60- '<template><math><mspace/></math></template>'
60+ '<template><math><mspace/></math></template>' ,
6161
62- // Other cases are in `invalid` tests.
62+ // Don't error if there are comments in their content.
63+ {
64+ code : '<template><div><!-- comment --></div></template>' ,
65+ output : null ,
66+ options : [ { html : { normal : 'always' } } ]
67+ }
68+
69+ // other cases are in `invalid` tests.
6370 ] ,
6471 invalid : [
72+ // default
73+ {
74+ code : '<template><div/></template>' ,
75+ output : '<template><div></div></template>' ,
76+ errors : [ 'Disallow self-closing on HTML elements.' ]
77+ } ,
78+ {
79+ code : '<template><img/></template>' ,
80+ output : '<template><img></template>' ,
81+ errors : [ 'Disallow self-closing on HTML void elements.' ]
82+ } ,
83+ {
84+ code : '<template><x-test></x-test></template>' ,
85+ output : '<template><x-test/></template>' ,
86+ errors : [ 'Require self-closing on Vue.js custom components.' ]
87+ } ,
88+ {
89+ code : '<template><svg><path></path></svg></template>' ,
90+ output : '<template><svg><path/></svg></template>' ,
91+ errors : [ 'Require self-closing on SVG elements.' ]
92+ } ,
93+ {
94+ code : '<template><math><mspace></mspace></math></template>' ,
95+ output : '<template><math><mspace/></math></template>' ,
96+ errors : [ 'Require self-closing on MathML elements.' ]
97+ } ,
98+
99+ // others
65100 {
66101 code : ALL_CODE ,
67102 output : `<template>
0 commit comments