|
|
@@ -10,6 +10,7 @@ import {
|
|
|
insert,
|
|
|
prepend,
|
|
|
renderEffect,
|
|
|
+ setInsertionState,
|
|
|
template,
|
|
|
} from '../src'
|
|
|
import { currentInstance, nextTick, ref } from '@vue/runtime-dom'
|
|
|
@@ -502,5 +503,35 @@ describe('component: slots', () => {
|
|
|
await nextTick()
|
|
|
expect(host.innerHTML).toBe('<div><h1></h1><!--slot--></div>')
|
|
|
})
|
|
|
+
|
|
|
+ test('consecutive slots with insertion state', async () => {
|
|
|
+ const { component: Child } = define({
|
|
|
+ setup() {
|
|
|
+ const n2 = template('<div><div>baz</div></div>', true)() as any
|
|
|
+ setInsertionState(n2, 0)
|
|
|
+ createSlot('default', null)
|
|
|
+ setInsertionState(n2, 0)
|
|
|
+ createSlot('foo', null)
|
|
|
+ return n2
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ const { html } = define({
|
|
|
+ setup() {
|
|
|
+ return createComponent(Child, null, {
|
|
|
+ default: () => template('default')(),
|
|
|
+ foo: () => template('foo')(),
|
|
|
+ })
|
|
|
+ },
|
|
|
+ }).render()
|
|
|
+
|
|
|
+ expect(html()).toBe(
|
|
|
+ `<div>` +
|
|
|
+ `default<!--slot-->` +
|
|
|
+ `foo<!--slot-->` +
|
|
|
+ `<div>baz</div>` +
|
|
|
+ `</div>`,
|
|
|
+ )
|
|
|
+ })
|
|
|
})
|
|
|
})
|