-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into docs_fix_api_typo
- Loading branch information
Showing
5 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
code/lib/test/template/stories/destructuring-not-transpiled.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { expect } from '@storybook/test'; | ||
import { global as globalThis } from '@storybook/global'; | ||
|
||
export default { | ||
component: globalThis.Components.Button, | ||
args: { label: 'Button' }, | ||
}; | ||
|
||
// We must not transpile destructuring, to make sure that we can analyze the context properties that are used in play. | ||
// See: https://github.com/storybookjs/storybook/discussions/27389 | ||
export const DestructureNotTranspiled = { | ||
parameters: { chromatic: { disable: true } }, | ||
async play() { | ||
async function fn({ destructured }: { destructured: unknown }) { | ||
console.log(destructured); | ||
} | ||
const match = fn.toString().match(/[^(]*\(([^)]*)/); | ||
const params = match?.[0]; | ||
await expect(params).toContain('destructured'); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters