mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
add tests stories for ts named export
This commit is contained in:
parent
d27c4dc8c4
commit
edce7aa6e6
@ -20,7 +20,7 @@ export const ReferenceTypeProps: Story = {
|
||||
stringArray: ['Foo', 'Bar', 'Baz'],
|
||||
bar: 1,
|
||||
unionOptional: 'Foo',
|
||||
union: 10,
|
||||
union: 'Foo',
|
||||
inlined: { foo: 'Foo' },
|
||||
nested: { nestedProp: 'Nested Prop' },
|
||||
nestedIntersection: { nestedProp: 'Nested Prop', additionalProp: 'Additional Prop' },
|
||||
|
@ -0,0 +1,12 @@
|
||||
import type { StoryObj, Meta } from '@storybook/vue3';
|
||||
|
||||
import { ComponentA } from './ts-named-export/component';
|
||||
|
||||
const meta = {
|
||||
component: ComponentA,
|
||||
tags: ['autodocs'],
|
||||
} satisfies Meta<typeof ComponentA>;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
export default meta;
|
||||
|
||||
export const Default: Story = { args: { size: 'large', backgroundColor: 'blue' } };
|
@ -1,5 +1,52 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import type { PropType } from 'vue';
|
||||
import { defineComponent, h } from 'vue';
|
||||
|
||||
export const Foo = defineComponent((_: { foo: string }) => () => {});
|
||||
export const ComponentA = defineComponent({
|
||||
name: 'MyCompo1',
|
||||
props: {
|
||||
/**
|
||||
* This is a description of the prop
|
||||
* @values 'small', 'medium', 'large'
|
||||
* @defaultValue 'medium'
|
||||
* @control select
|
||||
* @group Size
|
||||
* */
|
||||
size: {
|
||||
type: String as PropType<'small' | 'medium' | 'large'>,
|
||||
default: 'medium',
|
||||
},
|
||||
/**
|
||||
* This is a description of the prop
|
||||
* @defaultValue false
|
||||
* @control color
|
||||
* @group Style
|
||||
* */
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: 'red',
|
||||
},
|
||||
},
|
||||
setup(props: any) {
|
||||
return () => h('pre', JSON.stringify(props, null, 2));
|
||||
},
|
||||
});
|
||||
|
||||
export const Bar = defineComponent((_: { bar?: number }) => () => {});
|
||||
export const ComponentB = defineComponent({
|
||||
name: 'MyCompo2',
|
||||
props: {
|
||||
/**
|
||||
* This is a description of the prop
|
||||
* @values true, false
|
||||
* @defaultValue false
|
||||
* @control boolean
|
||||
* @group Size
|
||||
* */
|
||||
primary: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props: any) {
|
||||
return () => h('pre', JSON.stringify(props, null, 2));
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user