Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pie-storybook): DSW-2593 improve logic for conditional rendering of stories #2088

Merged
merged 36 commits into from
Nov 29, 2024

Conversation

siggerzz
Copy link
Contributor

@siggerzz siggerzz commented Nov 20, 2024

Describe your changes (can list changeset entries if preferable)

This PR aims to improve the logic for the conditional rendering of stories. Previously, only stories with the .test.stories.ts extension were rendered in the new Storybook Testing deployment.

With this PR, we've introduced test specific stories in pie-storybook/stories/testing as we look to migrate more of our tests to use Storybook for the testbed.

Component Variant Stories
A new createVariantStory has been introduced to replicate the functionality of the old WebComponentTestWrapper.

Storybook example here

// pie-chip.test.stories.ts
const sharedPropOptions = {
    disabled: [true, false],
    isSelected: [true, false],
    isLoading: [true, false],
    isDismissible: [true, false],
    showIcon: [true, false],
    slot: ['Hello World'],
};

const defaultPropOptions = {
    ...sharedPropOptions,
    variant: ['default'],
};

const ghostPropOptions = {
    ...sharedPropOptions,
    variant: ['ghost'],
};

const outlinePropOptions = {
    ...sharedPropOptions,
    variant: ['outline'],
};

export const DefaultPropVariations = createVariantStory<ChipProps>(Template, defaultPropOptions);
export const GhostPropVariations = createVariantStory<ChipProps>(Template, ghostPropOptions);
export const OutlinePropVariations = createVariantStory<ChipProps>(Template, outlinePropOptions);

@justeattakeaway/generator-pie-component

  • Updated and tested generator to align with new testing process

Docs - https://github.com/justeattakeaway/pie/wiki/Testing-of-PIE-Components

Author Checklist (complete before requesting a review)

  • I have performed a self-review of my code
  • I have reviewed the PIE Storybook/PIE Docs PR preview

Reviewer checklists (complete before approving)

Reviewer 1 - @fernandofranca

  • I have reviewed the PIE Storybook/PIE Docs PR preview

Reviewer 2 - @jamieomaguire

  • I have reviewed the PIE Storybook/PIE Docs PR preview

@siggerzz siggerzz requested review from a team as code owners November 20, 2024 16:41
Copy link

changeset-bot bot commented Nov 20, 2024

🦋 Changeset detected

Latest commit: ff40cf7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@justeattakeaway/generator-pie-component Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@siggerzz siggerzz force-pushed the wcp-2593-storybook-selective-rendering branch from f013255 to faeb870 Compare November 26, 2024 15:26
@siggerzz siggerzz marked this pull request as ready for review November 26, 2024 15:39
raoufswe
raoufswe previously approved these changes Nov 26, 2024
@siggerzz siggerzz changed the title feat(pie-storybook): Improve logic for conditional rendering of stories feat(pie-storybook): improve logic for conditional rendering of stories Nov 26, 2024
@siggerzz siggerzz changed the title feat(pie-storybook): improve logic for conditional rendering of stories feat(pie-storybook): DSW-2593 improve logic for conditional rendering of stories Nov 26, 2024
@siggerzz siggerzz force-pushed the wcp-2593-storybook-selective-rendering branch from b9f492e to 6ff9eb6 Compare November 29, 2024 09:44
fernandofranca
fernandofranca previously approved these changes Nov 29, 2024
Copy link
Contributor

@jamieomaguire jamieomaguire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, but please can you write up some documentation before merging? Basically how do we write stories and where, with this new approach and explain when and how to use each, I think.

jamieomaguire
jamieomaguire previously approved these changes Nov 29, 2024
@siggerzz
Copy link
Contributor Author

All looks good, but please can you write up some documentation before merging? Basically how do we write stories and where, with this new approach and explain when and how to use each, I think.

As discussed, this has already be done, and will be improved futher at the end of this epic 👍🏼

@siggerzz siggerzz merged commit 9a252c6 into main Nov 29, 2024
28 checks passed
@siggerzz siggerzz deleted the wcp-2593-storybook-selective-rendering branch November 29, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants