@@ -36,6 +36,18 @@ tester.run('no-restricted-html-elements', rule, {
36
36
filename : 'test.vue' ,
37
37
code : '<template><main><article></article></main></template>' ,
38
38
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' ]
39
51
}
40
52
] ,
41
53
invalid : [
@@ -45,7 +57,7 @@ tester.run('no-restricted-html-elements', rule, {
45
57
options : [ 'button' ] ,
46
58
errors : [
47
59
{
48
- message : 'Unexpected use of forbidden HTML element button.' ,
60
+ message : 'Unexpected use of forbidden element button.' ,
49
61
line : 1 ,
50
62
column : 16
51
63
}
@@ -57,7 +69,7 @@ tester.run('no-restricted-html-elements', rule, {
57
69
options : [ 'div' ] ,
58
70
errors : [
59
71
{
60
- message : 'Unexpected use of forbidden HTML element div.' ,
72
+ message : 'Unexpected use of forbidden element div.' ,
61
73
line : 1 ,
62
74
column : 11
63
75
}
@@ -96,6 +108,63 @@ tester.run('no-restricted-html-elements', rule, {
96
108
column : 18
97
109
}
98
110
]
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
+ ]
99
168
}
100
169
]
101
170
} )
0 commit comments