Skip to content

Commit c12c272

Browse files
authored
test(no-empty-component-block): make tests more strict (#2890)
1 parent 5a53369 commit c12c272

File tree

1 file changed

+155
-31
lines changed

1 file changed

+155
-31
lines changed

tests/lib/rules/no-empty-component-block.js

Lines changed: 155 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ tester.run('no-empty-component-block', rule, {
3030
output: '',
3131
errors: [
3232
{
33-
message: '`<template>` is empty. Empty block is not allowed.'
33+
message: '`<template>` is empty. Empty block is not allowed.',
34+
line: 1,
35+
column: 1,
36+
endLine: 1,
37+
endColumn: 22
3438
}
3539
]
3640
},
@@ -39,7 +43,11 @@ tester.run('no-empty-component-block', rule, {
3943
output: '',
4044
errors: [
4145
{
42-
message: '`<template>` is empty. Empty block is not allowed.'
46+
message: '`<template>` is empty. Empty block is not allowed.',
47+
line: 1,
48+
column: 1,
49+
endLine: 1,
50+
endColumn: 23
4351
}
4452
]
4553
},
@@ -49,7 +57,11 @@ tester.run('no-empty-component-block', rule, {
4957
output: '',
5058
errors: [
5159
{
52-
message: '`<template>` is empty. Empty block is not allowed.'
60+
message: '`<template>` is empty. Empty block is not allowed.',
61+
line: 1,
62+
column: 1,
63+
endLine: 2,
64+
endColumn: 12
5365
}
5466
]
5567
},
@@ -58,7 +70,11 @@ tester.run('no-empty-component-block', rule, {
5870
output: '',
5971
errors: [
6072
{
61-
message: '`<template>` is empty. Empty block is not allowed.'
73+
message: '`<template>` is empty. Empty block is not allowed.',
74+
line: 1,
75+
column: 1,
76+
endLine: 1,
77+
endColumn: 13
6278
}
6379
]
6480
},
@@ -67,7 +83,11 @@ tester.run('no-empty-component-block', rule, {
6783
output: '',
6884
errors: [
6985
{
70-
message: '`<template>` is empty. Empty block is not allowed.'
86+
message: '`<template>` is empty. Empty block is not allowed.',
87+
line: 1,
88+
column: 1,
89+
endLine: 1,
90+
endColumn: 20
7191
}
7292
]
7393
},
@@ -76,10 +96,18 @@ tester.run('no-empty-component-block', rule, {
7696
output: '<script></script>',
7797
errors: [
7898
{
79-
message: '`<template>` is empty. Empty block is not allowed.'
99+
message: '`<template>` is empty. Empty block is not allowed.',
100+
line: 1,
101+
column: 1,
102+
endLine: 1,
103+
endColumn: 22
80104
},
81105
{
82-
message: '`<script>` is empty. Empty block is not allowed.'
106+
message: '`<script>` is empty. Empty block is not allowed.',
107+
line: 1,
108+
column: 22,
109+
endLine: 1,
110+
endColumn: 39
83111
}
84112
]
85113
},
@@ -88,10 +116,18 @@ tester.run('no-empty-component-block', rule, {
88116
output: '<script />',
89117
errors: [
90118
{
91-
message: '`<template>` is empty. Empty block is not allowed.'
119+
message: '`<template>` is empty. Empty block is not allowed.',
120+
line: 1,
121+
column: 1,
122+
endLine: 1,
123+
endColumn: 13
92124
},
93125
{
94-
message: '`<script>` is empty. Empty block is not allowed.'
126+
message: '`<script>` is empty. Empty block is not allowed.',
127+
line: 1,
128+
column: 13,
129+
endLine: 1,
130+
endColumn: 23
95131
}
96132
]
97133
},
@@ -100,10 +136,18 @@ tester.run('no-empty-component-block', rule, {
100136
output: '<script src="" />',
101137
errors: [
102138
{
103-
message: '`<template>` is empty. Empty block is not allowed.'
139+
message: '`<template>` is empty. Empty block is not allowed.',
140+
line: 1,
141+
column: 1,
142+
endLine: 1,
143+
endColumn: 20
104144
},
105145
{
106-
message: '`<script>` is empty. Empty block is not allowed.'
146+
message: '`<script>` is empty. Empty block is not allowed.',
147+
line: 1,
148+
column: 20,
149+
endLine: 1,
150+
endColumn: 37
107151
}
108152
]
109153
},
@@ -112,13 +156,25 @@ tester.run('no-empty-component-block', rule, {
112156
output: '<script></script>',
113157
errors: [
114158
{
115-
message: '`<template>` is empty. Empty block is not allowed.'
159+
message: '`<template>` is empty. Empty block is not allowed.',
160+
line: 1,
161+
column: 1,
162+
endLine: 1,
163+
endColumn: 22
116164
},
117165
{
118-
message: '`<script>` is empty. Empty block is not allowed.'
166+
message: '`<script>` is empty. Empty block is not allowed.',
167+
line: 1,
168+
column: 22,
169+
endLine: 1,
170+
endColumn: 39
119171
},
120172
{
121-
message: '`<style>` is empty. Empty block is not allowed.'
173+
message: '`<style>` is empty. Empty block is not allowed.',
174+
line: 1,
175+
column: 39,
176+
endLine: 1,
177+
endColumn: 54
122178
}
123179
]
124180
},
@@ -127,13 +183,25 @@ tester.run('no-empty-component-block', rule, {
127183
output: '<script />',
128184
errors: [
129185
{
130-
message: '`<template>` is empty. Empty block is not allowed.'
186+
message: '`<template>` is empty. Empty block is not allowed.',
187+
line: 1,
188+
column: 1,
189+
endLine: 1,
190+
endColumn: 13
131191
},
132192
{
133-
message: '`<script>` is empty. Empty block is not allowed.'
193+
message: '`<script>` is empty. Empty block is not allowed.',
194+
line: 1,
195+
column: 13,
196+
endLine: 1,
197+
endColumn: 23
134198
},
135199
{
136-
message: '`<style>` is empty. Empty block is not allowed.'
200+
message: '`<style>` is empty. Empty block is not allowed.',
201+
line: 1,
202+
column: 23,
203+
endLine: 1,
204+
endColumn: 32
137205
}
138206
]
139207
},
@@ -142,13 +210,25 @@ tester.run('no-empty-component-block', rule, {
142210
output: '<script src="" />',
143211
errors: [
144212
{
145-
message: '`<template>` is empty. Empty block is not allowed.'
213+
message: '`<template>` is empty. Empty block is not allowed.',
214+
line: 1,
215+
column: 1,
216+
endLine: 1,
217+
endColumn: 20
146218
},
147219
{
148-
message: '`<script>` is empty. Empty block is not allowed.'
220+
message: '`<script>` is empty. Empty block is not allowed.',
221+
line: 1,
222+
column: 20,
223+
endLine: 1,
224+
endColumn: 37
149225
},
150226
{
151-
message: '`<style>` is empty. Empty block is not allowed.'
227+
message: '`<style>` is empty. Empty block is not allowed.',
228+
line: 1,
229+
column: 37,
230+
endLine: 1,
231+
endColumn: 53
152232
}
153233
]
154234
},
@@ -158,13 +238,25 @@ tester.run('no-empty-component-block', rule, {
158238
output: ' ',
159239
errors: [
160240
{
161-
message: '`<template>` is empty. Empty block is not allowed.'
241+
message: '`<template>` is empty. Empty block is not allowed.',
242+
line: 1,
243+
column: 1,
244+
endLine: 1,
245+
endColumn: 22
162246
},
163247
{
164-
message: '`<script>` is empty. Empty block is not allowed.'
248+
message: '`<script>` is empty. Empty block is not allowed.',
249+
line: 1,
250+
column: 23,
251+
endLine: 1,
252+
endColumn: 40
165253
},
166254
{
167-
message: '`<style>` is empty. Empty block is not allowed.'
255+
message: '`<style>` is empty. Empty block is not allowed.',
256+
line: 1,
257+
column: 41,
258+
endLine: 1,
259+
endColumn: 56
168260
}
169261
]
170262
},
@@ -173,13 +265,25 @@ tester.run('no-empty-component-block', rule, {
173265
output: ' ',
174266
errors: [
175267
{
176-
message: '`<template>` is empty. Empty block is not allowed.'
268+
message: '`<template>` is empty. Empty block is not allowed.',
269+
line: 1,
270+
column: 1,
271+
endLine: 1,
272+
endColumn: 13
177273
},
178274
{
179-
message: '`<script>` is empty. Empty block is not allowed.'
275+
message: '`<script>` is empty. Empty block is not allowed.',
276+
line: 1,
277+
column: 14,
278+
endLine: 1,
279+
endColumn: 24
180280
},
181281
{
182-
message: '`<style>` is empty. Empty block is not allowed.'
282+
message: '`<style>` is empty. Empty block is not allowed.',
283+
line: 1,
284+
column: 25,
285+
endLine: 1,
286+
endColumn: 34
183287
}
184288
]
185289
},
@@ -188,13 +292,25 @@ tester.run('no-empty-component-block', rule, {
188292
output: ' ',
189293
errors: [
190294
{
191-
message: '`<template>` is empty. Empty block is not allowed.'
295+
message: '`<template>` is empty. Empty block is not allowed.',
296+
line: 1,
297+
column: 1,
298+
endLine: 1,
299+
endColumn: 20
192300
},
193301
{
194-
message: '`<script>` is empty. Empty block is not allowed.'
302+
message: '`<script>` is empty. Empty block is not allowed.',
303+
line: 1,
304+
column: 21,
305+
endLine: 1,
306+
endColumn: 38
195307
},
196308
{
197-
message: '`<style>` is empty. Empty block is not allowed.'
309+
message: '`<style>` is empty. Empty block is not allowed.',
310+
line: 1,
311+
column: 39,
312+
endLine: 1,
313+
endColumn: 55
198314
}
199315
]
200316
},
@@ -203,10 +319,18 @@ tester.run('no-empty-component-block', rule, {
203319
output: '<template><p></p></template> ',
204320
errors: [
205321
{
206-
message: '`<script>` is empty. Empty block is not allowed.'
322+
message: '`<script>` is empty. Empty block is not allowed.',
323+
line: 1,
324+
column: 30,
325+
endLine: 1,
326+
endColumn: 47
207327
},
208328
{
209-
message: '`<style>` is empty. Empty block is not allowed.'
329+
message: '`<style>` is empty. Empty block is not allowed.',
330+
line: 1,
331+
column: 48,
332+
endLine: 1,
333+
endColumn: 64
210334
}
211335
]
212336
}

0 commit comments

Comments
 (0)