diff --git a/packages/runtime-core/__tests__/rendererAttrsFallthrough.spec.ts b/packages/runtime-core/__tests__/rendererAttrsFallthrough.spec.ts index 1de05b67b44..5e885a3d59c 100644 --- a/packages/runtime-core/__tests__/rendererAttrsFallthrough.spec.ts +++ b/packages/runtime-core/__tests__/rendererAttrsFallthrough.spec.ts @@ -13,6 +13,8 @@ import { defineComponent, openBlock, createBlock, + createElementVNode, + createElementBlock, FunctionalComponent, createCommentVNode, Fragment, @@ -673,6 +675,58 @@ describe('attribute fallthrough', () => { expect(click).toHaveBeenCalled() }) + it('should support fallthrough for nested fragments', async () => { + const toggle = ref(false) + + const Child = { + setup() { + return () => ( + openBlock(), + createElementBlock( + Fragment, + null, + [ + createCommentVNode(' comment A '), + toggle.value + ? (openBlock(), createElementBlock('span', { key: 0 }, 'Foo')) + : (openBlock(), + createElementBlock( + Fragment, + { key: 1 }, + [ + createCommentVNode(' comment B '), + createElementVNode('div', null, 'Bar') + ], + PatchFlags.STABLE_FRAGMENT | PatchFlags.DEV_ROOT_FRAGMENT + )) + ], + PatchFlags.STABLE_FRAGMENT | PatchFlags.DEV_ROOT_FRAGMENT + ) + ) + } + } + + const Root = { + setup() { + return () => (openBlock(), createBlock(Child, { class: 'red' })) + } + } + + const root = document.createElement('div') + document.body.appendChild(root) + render(h(Root), root) + + expect(root.innerHTML).toBe( + `