@@ -36,6 +36,18 @@ tester.run('no-restricted-html-elements', rule, {
3636 filename : 'test.vue' ,
3737 code : '<template><main><article></article></main></template>' ,
3838 options : [ { element : [ 'div' , 'span' ] } ]
39+ } ,
40+ // SVG
41+ {
42+ filename : 'test.vue' ,
43+ code : '<template><svg><rect width="100" height="100"></rect></svg></template>' ,
44+ options : [ 'circle' ]
45+ } ,
46+ // Math
47+ {
48+ filename : 'test.vue' ,
49+ code : '<template><math><mn>2</mn></math></template>' ,
50+ options : [ 'mi' ]
3951 }
4052 ] ,
4153 invalid : [
@@ -45,7 +57,7 @@ tester.run('no-restricted-html-elements', rule, {
4557 options : [ 'button' ] ,
4658 errors : [
4759 {
48- message : 'Unexpected use of forbidden HTML element button.' ,
60+ message : 'Unexpected use of forbidden element button.' ,
4961 line : 1 ,
5062 column : 16
5163 }
@@ -57,7 +69,7 @@ tester.run('no-restricted-html-elements', rule, {
5769 options : [ 'div' ] ,
5870 errors : [
5971 {
60- message : 'Unexpected use of forbidden HTML element div.' ,
72+ message : 'Unexpected use of forbidden element div.' ,
6173 line : 1 ,
6274 column : 11
6375 }
@@ -96,6 +108,63 @@ tester.run('no-restricted-html-elements', rule, {
96108 column : 18
97109 }
98110 ]
111+ } ,
112+ // SVG
113+ {
114+ filename : 'test.vue' ,
115+ code : '<template><svg><circle r="50"></circle></svg></template>' ,
116+ options : [ 'circle' ] ,
117+ errors : [
118+ {
119+ message : 'Unexpected use of forbidden element circle.' ,
120+ line : 1 ,
121+ column : 16
122+ }
123+ ]
124+ } ,
125+ {
126+ filename : 'test.vue' ,
127+ code : '<template><svg><rect width="100" height="100"></rect><path d="M10,10 L20,20"></path></svg></template>' ,
128+ options : [
129+ { element : [ 'rect' , 'path' ] , message : 'Use simplified shapes instead' }
130+ ] ,
131+ errors : [
132+ {
133+ message : 'Use simplified shapes instead' ,
134+ line : 1 ,
135+ column : 16
136+ } ,
137+ {
138+ message : 'Use simplified shapes instead' ,
139+ line : 1 ,
140+ column : 54
141+ }
142+ ]
143+ } ,
144+ // Math
145+ {
146+ filename : 'test.vue' ,
147+ code : '<template><math><mfrac><mn>1</mn><mn>2</mn></mfrac></math></template>' ,
148+ options : [ 'mfrac' ] ,
149+ errors : [
150+ {
151+ message : 'Unexpected use of forbidden element mfrac.' ,
152+ line : 1 ,
153+ column : 17
154+ }
155+ ]
156+ } ,
157+ {
158+ filename : 'test.vue' ,
159+ code : '<template><math><mi>x</mi><mo>=</mo><mn>5</mn></math></template>' ,
160+ options : [ { element : 'mo' , message : 'Avoid using operators directly' } ] ,
161+ errors : [
162+ {
163+ message : 'Avoid using operators directly' ,
164+ line : 1 ,
165+ column : 27
166+ }
167+ ]
99168 }
100169 ]
101170} )
0 commit comments