-
-
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 pull request #12322 from storybookjs/11839-undefined-boolean-prop
Addon-controls: Fix uncontrolled to controlled warning for booleans
- Loading branch information
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...sink/src/stories/issues/11839-undefined-bolean-prop/__snapshots__/index.stories.storyshot
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Issues/11839 undefined boolean Primary 1`] = ` | ||
<div> | ||
Disabled: false | ||
</div> | ||
`; |
14 changes: 14 additions & 0 deletions
14
examples/vue-kitchen-sink/src/stories/issues/11839-undefined-bolean-prop/component.vue
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,14 @@ | ||
<template> | ||
<div>Disabled: {{disabled}}</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
disabled: Boolean, | ||
}, | ||
mounted() { | ||
console.log(this.disabled); // notice this line | ||
}, | ||
}; | ||
</script> |
15 changes: 15 additions & 0 deletions
15
examples/vue-kitchen-sink/src/stories/issues/11839-undefined-bolean-prop/index.stories.js
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,15 @@ | ||
import Comp from './component.vue'; | ||
|
||
export default { | ||
title: 'Issues/11839 undefined boolean', | ||
component: Comp, | ||
}; | ||
|
||
export const Primary = (args, { argTypes }) => { | ||
return { | ||
props: Object.keys(argTypes), | ||
components: { Comp }, | ||
// template: '<Comp />', // this will log out `false` | ||
template: '<Comp v-bind="$props" />', // this will log out `undefined` | ||
}; | ||
}; |
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