diff --git a/src/index.ts b/src/index.ts index 5f057e6..129ecc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -107,14 +107,16 @@ function injectProviderComponent( const template = getRootBlock(root, 'template') if (!template) { console.warn( - `To +" +`; + +exports[`index > injects inside root node with multiple child elements 1`] = ` +" + + " @@ -73,9 +102,9 @@ export default {

Nothing to see here

-
-/> + " `; @@ -86,7 +115,7 @@ exports[`index > injects the template block into an normally structured sfc 1`] - + " `; diff --git a/test/index.test.ts b/test/index.test.ts index 6853b20..8ee2ef0 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -67,6 +67,36 @@ function handleLoginSubmit(values: any) { ).toMatchSnapshot() }) + it('injects inside root node with multiple child elements', async () => { + expect( + ( + await plugin.transform( + ` + + +`, + 'test.vue', + ) + ).code, + ).toMatchSnapshot() + }) + it('injects import into script setup block', async () => { expect( (await plugin.transform(aboutSFCFile, 'about.vue')).code,