From 2468f04cc9f94e2d8892eb536d478ec94e875f86 Mon Sep 17 00:00:00 2001 From: Mateusz Kadlubowski Date: Thu, 5 Sep 2024 12:01:23 +0800 Subject: [PATCH] add test for using both directives - `let:args` & `let:context` --- .../codemods/legacy-story.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/compiler/pre-transform/codemods/legacy-story.test.ts b/src/compiler/pre-transform/codemods/legacy-story.test.ts index a41e934..bd3120f 100644 --- a/src/compiler/pre-transform/codemods/legacy-story.test.ts +++ b/src/compiler/pre-transform/codemods/legacy-story.test.ts @@ -192,4 +192,29 @@ describe(transformLegacyStory.name, () => { " `); }); + + it("when both directives 'let:args' and 'let:context' is used then it wraps Story fragment with 'children' snippet block", async ({ + expect, + }) => { + const code = ` + + + +

{args.title}

+

{context.id}

+
+ `; + const node = await parseAndExtractSvelteNode(code, 'Component'); + + expect(print(transformLegacyStory({ node }))).toMatchInlineSnapshot(` + " + {#snippet children(args, context)} +

{args.title}

+

{context.id}

+ {/snippet} +
" + `); + }); });