add tests stories for ts named export

This commit is contained in:
chakAs3 2023-07-05 10:04:06 +04:00
parent d27c4dc8c4
commit edce7aa6e6
3 changed files with 63 additions and 4 deletions

View File

@ -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' },

View File

@ -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' } };

View File

@ -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));
},
});