Skip to content

Commit b1b5a14

Browse files
committed
chore : add new tests for warning varification
1 parent 680bed3 commit b1b5a14

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/compiler-core/__tests__/transforms/transformElement.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,17 @@ describe('compiler: element transform', () => {
12531253
)
12541254
})
12551255

1256+
test('does not warn if has one component child and multiple comment children', () => {
1257+
checkWarning(
1258+
`<KeepAlive>
1259+
<!-- this should be ignored -->
1260+
<component :is="activeComponent"/>
1261+
<!-- this should be ignored -->
1262+
</KeepAlive>`,
1263+
false
1264+
)
1265+
})
1266+
12561267
test('warn if has multiple children', () => {
12571268
checkWarning(
12581269
`<KeepAlive>
@@ -1263,6 +1274,18 @@ describe('compiler: element transform', () => {
12631274
)
12641275
})
12651276

1277+
test('warn if has multiple component child and multiple comment children', () => {
1278+
checkWarning(
1279+
`<KeepAlive>
1280+
<!-- this should be ignored -->
1281+
<component :is="activeComponent"/>
1282+
<component :is="activeComponent2"/>
1283+
<!-- this should be ignored -->
1284+
</KeepAlive>`,
1285+
true
1286+
)
1287+
})
1288+
12661289
test('should ignore comments', () => {
12671290
expect(baseCompile(
12681291
`<KeepAlive>

0 commit comments

Comments
 (0)