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

Integrate storybook for components #3

Open
chrisvfritz opened this issue Feb 20, 2018 · 22 comments
Open

Integrate storybook for components #3

chrisvfritz opened this issue Feb 20, 2018 · 22 comments
Labels
enhancement New feature or request

Comments

@chrisvfritz
Copy link
Collaborator

I'd like it to be pretty seamless and built into the main development workflow, so possibly as a <story> custom block inside .vue files.

@shentao
Copy link

shentao commented Feb 20, 2018

It also came to my mind, though I’m worried the SFC file might get a bit crowded. But I guess this can be easily solved with an opt-in/opt-out prompt when using the component generator.

@chrisvfritz chrisvfritz added the enhancement New feature or request label Feb 21, 2018
@shentao
Copy link

shentao commented Feb 21, 2018

Btw. it might be quite nice to include a Loki setup on top of Storybook.

@mattrothenberg
Copy link

I would love to tackle this. Any ideas around what content you envision putting into that <story></story> block? For example –

// PrimaryButton.vue
<template>
  <button :disabled="disabled">
    <slot></slot>
  </button>
</template>

<script>
export default {
  name: 'primary-button',
  props: ['disabled']
}
</script>

<story>
  <primary-button :disabled="true">Hello!</primary-button>
</story>

@shentao
Copy link

shentao commented Mar 2, 2018

What about something like

<story case="button is disabled">
  <primary-button :disabled="true">Hello!</primary-button>
</story>

<story case="button is enabled">
  <primary-button :disabled="false">Hello!</primary-button>
</story>

Not sure how to handle actions and variables though.

@mattrothenberg
Copy link

@shentao Excellent, I like that API. I'll put together a proof-of-concept here shortly

@mattrothenberg
Copy link

mattrothenberg commented Mar 2, 2018

Repo: https://github.com/mattrothenberg/vue-storybook/
I wrote a custom Webpack loader that parses the <story> block and pulls out the requisite information.

@chrisvfritz
Copy link
Collaborator Author

I like it! I'll be taking a closer look at this soon. 😻

@mattrothenberg
Copy link

Hooray! I welcome any/all feedback, given I'm more of a designer than a dev 😈

@chrisvfritz
Copy link
Collaborator Author

@mattrothenberg Evan used to say that too. 😉

@chrisvfritz
Copy link
Collaborator Author

Just an update here: I'll finally be able to look into this a little more after VueConf next week, but am also a little bit torn. I'm playing with the possibility of using Cypress for component unit tests, instead of Jest, which would also provide a lot of the same benefits of Storybook. That would mean fewer tools for developers to learn, so if I can get it to work the way I want, I might be leaning in that direction.

@mattrothenberg
Copy link

Sounds good @chrisvfritz. In either event, it was fun (and a great learning exercise) to get that vue-storybook idea out of my head and into code. Keep me posted!

@patrickcate
Copy link

I'm playing with the possibility of using Cypress for component unit tests, instead of Jest

This is an interesting concept, any progress update?

@etroynov
Copy link

Hi all,

have some any news?

@chrisvfritz
Copy link
Collaborator Author

Still experimenting - nothing I've tried so far has been ideal, but I'm not out of ideas yet. 🙂

@saintplay
Copy link

saintplay commented Aug 26, 2018

Storybook has just released an alpha version with babel 7 support, and they have an officially plugin for storybook now. I guess we have to wait a bit longer, because the plugin is still not stable.

@chrisvfritz chrisvfritz added the blocked upstream There's an issue in a dependency that's blocking resolution label Sep 4, 2018
@riddla
Copy link

riddla commented Dec 7, 2018

@chrisvfritz: Could you elaborate on this topic?
I see Storybook more as a living component documentation and development tool. As it mainly focuses on presenting components in different states.
On the other hand Cypress can do unit testing and "behave like a user" respectively do proper end-to-end-testing.

I am curious: why do you think that Cypress (unit tests) give the the same (or some) benefits of Storybook?

@chrisvfritz
Copy link
Collaborator Author

@riddla I think the Cypress client could potentially offer a superset of what Storybook does. For example, custom blocks such as <docs> and <story> in .vue files could work in combination with a custom Cypress command to not only display documentation and component states, but also demonstrate specific workflows and at the same time, actually confirm that each component works the way it should.

Does that make sense?

@smile921
Copy link

good ! So how is it progressed now

@elevatebart
Copy link
Contributor

elevatebart commented Feb 21, 2019

Hello All, have you had a look at vue-styleguidist. it uses Markdown instead of JavaScript to write the examples in. Apart from that it does the same job as storybook... in <docs> block.

@freddiv
Copy link

freddiv commented Jun 27, 2019

Hi, I am trying to add storybook testing to the vue-enterprise-boilerplate. I already went through the learnstorybook tutorial for vue and it went smoothly. When I completed the setup in the vue-enterprise-boilerplate application and completed the tutorial code within this project everything worked except it doesn't pick up the styles. I tried everything I could think of but it just doesn't seem to pick up the styling at all in the storybook served test. Any ideas on what I can try next?

@chrisvfritz chrisvfritz removed the blocked upstream There's an issue in a dependency that's blocking resolution label Oct 3, 2019
@abreumatheus
Copy link

No news about this? :(

@marceloavf
Copy link

I get it working @abreumatheus and I'll try to pull request it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.