mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
feat(Timeline): new component (#4215)
Co-authored-by: Benjamin Canac <canacb1@gmail.com> Co-authored-by: Jakub <jakub.michalek@freelo.io>
This commit is contained in:
57
test/components/Timeline.spec.ts
Normal file
57
test/components/Timeline.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import Timeline, { type TimelineProps, type TimelineSlots } from '../../src/runtime/components/Timeline.vue'
|
||||
import ComponentRender from '../component-render'
|
||||
import theme from '#build/ui/timeline'
|
||||
|
||||
describe('Timeline', () => {
|
||||
const sizes = Object.keys(theme.variants.size) as any
|
||||
|
||||
const items = [{
|
||||
date: 'Mar 15, 2025',
|
||||
title: 'Project Kickoff',
|
||||
description: 'Kicked off the project with team alignment. Set up project milestones and allocated resources.',
|
||||
icon: 'i-lucide-rocket',
|
||||
value: 'kickoff'
|
||||
}, {
|
||||
date: 'Mar 22, 2025',
|
||||
title: 'Design Phase',
|
||||
description: 'User research and design workshops. Created wireframes and prototypes for user testing',
|
||||
icon: 'i-lucide-palette',
|
||||
value: 'design'
|
||||
}, {
|
||||
date: 'Mar 29, 2025',
|
||||
title: 'Development Sprint',
|
||||
description: 'Frontend and backend development. Implemented core features and integrated with APIs.',
|
||||
icon: 'i-lucide-code',
|
||||
value: 'development'
|
||||
}, {
|
||||
date: 'Apr 5, 2025',
|
||||
title: 'Testing & Deployment',
|
||||
description: 'QA testing and performance optimization. Deployed the application to production.',
|
||||
icon: 'i-lucide-check-circle',
|
||||
value: 'deployment'
|
||||
}]
|
||||
|
||||
const props = { items }
|
||||
|
||||
it.each([
|
||||
// Props
|
||||
['with items', { props }],
|
||||
['with modelValue', { props: { ...props, modelValue: 'assigned' } }],
|
||||
['with defaultValue', { props: { ...props, defaultValue: 'assigned' } }],
|
||||
['with neutral color', { props: { ...props, color: 'neutral' } }],
|
||||
...sizes.map((size: string) => [`with size ${size} horizontal`, { props: { ...props, size } }]),
|
||||
...sizes.map((size: string) => [`with size ${size} vertical`, { props: { ...props, size, orientation: 'vertical' } }]),
|
||||
['with as', { props: { ...props, as: 'section' } }],
|
||||
['with class', { props: { ...props, class: 'gap-8' } }],
|
||||
['with ui', { props: { ...props, ui: { title: 'font-bold' } } }],
|
||||
// Slots
|
||||
['with indicator slot', { props, slots: { indicator: () => 'Indicator slot' } }],
|
||||
['with date slot', { props, slots: { date: () => 'Date slot' } }],
|
||||
['with title slot', { props, slots: { title: () => 'Title slot' } }],
|
||||
['with description slot', { props, slots: { description: () => 'Description slot' } }]
|
||||
])('renders %s correctly', async (nameOrHtml: string, options: { props?: TimelineProps, slots?: Partial<TimelineSlots> }) => {
|
||||
const html = await ComponentRender(nameOrHtml, options, Timeline)
|
||||
expect(html).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
1306
test/components/__snapshots__/Timeline-vue.spec.ts.snap
Normal file
1306
test/components/__snapshots__/Timeline-vue.spec.ts.snap
Normal file
File diff suppressed because it is too large
Load Diff
1306
test/components/__snapshots__/Timeline.spec.ts.snap
Normal file
1306
test/components/__snapshots__/Timeline.spec.ts.snap
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user