diff --git a/src/compiler/pre-transform/codemods/legacy-story.test.ts b/src/compiler/pre-transform/codemods/legacy-story.test.ts index b298bb5..cb140d8 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.test.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.test.ts @@ -279,4 +279,59 @@ describe(transformLegacyStory.name, () => { " `); }); + + it("leaves existing Story parameters untouched", async ({ + expect, + }) => { + const code = ` + + + +

{"Test"}

+
+ `; + const component = await parseAndExtractSvelteNode(code, 'Component'); + + expect( + print( + transformLegacyStory({ + component, + state: { componentIdentifierName: {} }, + }) + ) + ).toMatchInlineSnapshot(` + " +

{"Test"}

+
" + `); + }); }); diff --git a/src/compiler/pre-transform/codemods/legacy-story.ts b/src/compiler/pre-transform/codemods/legacy-story.ts index eaa949c..13c2d31 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.ts @@ -109,6 +109,10 @@ export function transformLegacyStory(params: Params): SvelteAST.Component { }); } + if (parameters) { + newAttributes.push(parameters); + } + if (tags) { newAttributes.push(tags); }