Skip to content

Commit

Permalink
Merge pull request #29423 from storybookjs/svelte-autodoc-ts
Browse files Browse the repository at this point in the history
Svelte: Improve argTypes inference with `svelte2tsx` - support runes
  • Loading branch information
JReinhold authored Oct 24, 2024
2 parents 99b7c67 + 08c2bb9 commit 4cf32b0
Show file tree
Hide file tree
Showing 30 changed files with 1,484 additions and 230 deletions.
8 changes: 4 additions & 4 deletions code/e2e-tests/framework-svelte.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ test.describe('Svelte', () => {
test('JS story has auto-generated args table', async ({ page }) => {
const sbPage = new SbPage(page, expect);

await sbPage.navigateToStory('stories/renderers/svelte/js-docs', 'docs');
await sbPage.navigateToStory('stories/renderers/svelte/docs-jsdoc', 'docs');
const root = sbPage.previewRoot();
const argsTable = root.locator('.docblock-argstable');
await expect(argsTable).toContainText('Rounds the button');
await expect(argsTable).toContainText('Union of literal strings');
});

test('TS story has auto-generated args table', async ({ page }) => {
test.skip(!templateName?.endsWith('ts') || false, 'Only test TS story in TS templates');
const sbPage = new SbPage(page, expect);

await sbPage.navigateToStory('stories/renderers/svelte/ts-docs', 'docs');
await sbPage.navigateToStory('stories/renderers/svelte/docs-ts', 'docs');
const root = sbPage.previewRoot();
const argsTable = root.locator('.docblock-argstable');
await expect(argsTable).toContainText('Rounds the button');
await expect(argsTable).toContainText('Union of literal strings');
});

test('Decorators are excluded from generated source code', async ({ page }) => {
Expand Down
4 changes: 3 additions & 1 deletion code/frameworks/svelte-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
"@storybook/svelte": "workspace:*",
"magic-string": "^0.30.0",
"svelte-preprocess": "^5.1.1",
"svelte2tsx": "^0.7.13",
"sveltedoc-parser": "^4.2.1",
"ts-dedent": "^2.2.0"
"ts-dedent": "^2.2.0",
"typescript": "^4.9.4 || ^5.0.0"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^4.0.0",
Expand Down
Loading

0 comments on commit 4cf32b0

Please sign in to comment.