diff --git a/src/compiler/pre-transform/codemods/legacy-story.test.ts b/src/compiler/pre-transform/codemods/legacy-story.test.ts index cb140d8..517865c 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.test.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.test.ts @@ -188,6 +188,28 @@ describe(transformLegacyStory.name, () => { ).toMatchInlineSnapshot(`""`); }); + it("transforms 'template' prop to 'children' and text expression becomes expression tag with identifier to snippet (case with invalid identifier)", async ({ + expect, + }) => { + const code = ` + + + + `; + const component = await parseAndExtractSvelteNode(code, 'Component'); + + expect( + print( + transformLegacyStory({ + component, + state: { componentIdentifierName: {} }, + }) + ) + ).toMatchInlineSnapshot(`""`); + }); + it("when directive 'let:args' is used then it wraps Story fragment with 'children' snippet block", async ({ expect, }) => { @@ -280,9 +302,7 @@ describe(transformLegacyStory.name, () => { `); }); - it("leaves existing Story parameters untouched", async ({ - expect, - }) => { + it('leaves existing Story parameters untouched', async ({ expect }) => { const code = ` + + + `; + const component = await parseAndExtractSvelteNode(code, 'Component'); + + expect(print(transformTemplateToSnippet({ component }))).toMatchInlineSnapshot(` + "{#snippet template_haitqt(args)} +