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

Stories rework: VaForm #3699

Merged
merged 9 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/ui/.storybook/interaction-utils/addText.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { set } from "lodash"

type StoryStatus = 'stale'

const statusToText = (status?: StoryStatus) => {
if (status === 'stale') {
return `**<span style="color: #af0f0f">[${status}]</span>**`
}
return ''
}

export const addText = (story: any, text?: string, status?: StoryStatus) => {
set(story, 'parameters.docs.description.story', `${statusToText(status)} ${text || ''}`)
}
42 changes: 42 additions & 0 deletions packages/ui/.storybook/interaction-utils/userEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { userEvent as event } from '@storybook/testing-library'
import { sleep } from '../../src/utils/sleep'

export const userEvent = {
click: async (element: Element, options?: { delay?: number }) => {
const defaultOptions = { delay: 0 }
const mergedOptions = { ...defaultOptions, ...options }

event.click(element, undefined, { skipHover: true })
// waiting for DOM changes
await sleep(mergedOptions.delay)
},

type: async (element: Element, text: string, options?: { sleep?: boolean, delay?: number }) => {
const defaultOptions = { sleep: true, delay: 0 }
const mergedOptions = { ...defaultOptions, ...options }

event.type(element, text)
// waiting for DOM changes
if(mergedOptions.sleep) await sleep(mergedOptions.delay)
},

hover: async (element: Element, options?: { delay?: number }) => {
const defaultOptions = { delay: 0 }
const mergedOptions = { ...defaultOptions, ...options }

event.hover(element)
// waiting for DOM changes
await sleep(mergedOptions.delay)
},

unhover: async (element: Element, options?: { delay?: number }) => {
const defaultOptions = { delay: 0 }
const mergedOptions = { ...defaultOptions, ...options }

event.unhover(element)
// waiting for DOM changes
await sleep(mergedOptions.delay)
},

clear: async (element: Element) => event.clear(element)
}
82 changes: 0 additions & 82 deletions packages/ui/src/components/va-form/VaForm-reset.vue

This file was deleted.

204 changes: 0 additions & 204 deletions packages/ui/src/components/va-form/VaForm.demo.vue

This file was deleted.

Loading