Skip to content

Commit 66b649f

Browse files
committed
update: test
1 parent 867a6bf commit 66b649f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,7 @@ module.exports = {
113113
data: {
114114
blockName: componentBlock.name
115115
},
116-
fix: autofix
117-
? function* (fixer) {
118-
for (const componentBlock of emptyBlocks) {
119-
yield fixer.remove(componentBlock)
120-
}
121-
}
122-
: undefined
116+
fix: autofix ? (fixer) => fixer.remove(componentBlock) : undefined
123117
})
124118
}
125119
}

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ tester.run('no-empty-component-block', rule, {
170170
},
171171
{
172172
code: '<template></template><script></script><style></style>',
173-
output: '',
173+
output: '<script></script>',
174174
options: [{ autofix: true }],
175175
errors: [
176176
{
@@ -185,8 +185,8 @@ tester.run('no-empty-component-block', rule, {
185185
]
186186
},
187187
{
188-
code: '<template /><script /><style />',
189-
output: '',
188+
code: '<template></template> <script></script> <style></style>',
189+
output: ' ',
190190
options: [{ autofix: true }],
191191
errors: [
192192
{
@@ -201,8 +201,24 @@ tester.run('no-empty-component-block', rule, {
201201
]
202202
},
203203
{
204-
code: '<template src="" /><script src="" /><style src="" />',
205-
output: '',
204+
code: '<template /> <script /> <style />',
205+
output: ' ',
206+
options: [{ autofix: true }],
207+
errors: [
208+
{
209+
message: '`<template>` is empty. Empty block is not allowed.'
210+
},
211+
{
212+
message: '`<script>` is empty. Empty block is not allowed.'
213+
},
214+
{
215+
message: '`<style>` is empty. Empty block is not allowed.'
216+
}
217+
]
218+
},
219+
{
220+
code: '<template src="" /> <script src="" /> <style src="" />',
221+
output: ' ',
206222
options: [{ autofix: true }],
207223
errors: [
208224
{
@@ -217,8 +233,8 @@ tester.run('no-empty-component-block', rule, {
217233
]
218234
},
219235
{
220-
code: '<template><p></p></template><script src="" /><style src="" />',
221-
output: '<template><p></p></template>',
236+
code: '<template><p></p></template> <script src="" /> <style src="" />',
237+
output: '<template><p></p></template> ',
222238
options: [{ autofix: true }],
223239
errors: [
224240
{

0 commit comments

Comments
 (0)