Skip to content

Commit

Permalink
Merge pull request #1867 from storybooks/vue-cli-actions
Browse files Browse the repository at this point in the history
CLI: Use actions in sample stories for vue + fix them in SFC_VUE template
  • Loading branch information
Hypnosphi authored Sep 25, 2017
2 parents 0ff95a5 + 6f4b7eb commit 29ad9af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/cli/generators/SFC_VUE/template/src/stories/MyButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<script>
export default {
name: 'my-button',
methods: {
onClick () {
this.$emit('click');
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/cli/generators/VUE/template/stories/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { storiesOf } from '@storybook/vue';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';

import MyButton from './MyButton';
Expand All @@ -14,10 +15,10 @@ storiesOf('Button', module)
.add('with text', () => ({
components: { MyButton },
template: '<my-button @click="action">Hello Button</my-button>',
methods: { action: linkTo('clicked') },
methods: { action: action('clicked') },
}))
.add('with some emoji', () => ({
components: { MyButton },
template: '<my-button @click="action">😀 😎 👍 💯</my-button>',
methods: { action: linkTo('clicked') },
methods: { action: action('clicked') },
}));
3 changes: 2 additions & 1 deletion lib/cli/test/snapshots/sfc_vue/src/stories/MyButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<script>
export default {
name: 'my-button',
methods: {
onClick () {
this.$emit('click');
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/cli/test/snapshots/vue/stories/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { storiesOf } from '@storybook/vue';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';

import MyButton from './MyButton';
Expand All @@ -14,10 +15,10 @@ storiesOf('Button', module)
.add('with text', () => ({
components: { MyButton },
template: '<my-button @click="action">Hello Button</my-button>',
methods: { action: linkTo('clicked') },
methods: { action: action('clicked') },
}))
.add('with some emoji', () => ({
components: { MyButton },
template: '<my-button @click="action">😀 😎 👍 💯</my-button>',
methods: { action: linkTo('clicked') },
methods: { action: action('clicked') },
}));

0 comments on commit 29ad9af

Please sign in to comment.