Enable users to see all their saved events on the home screen, sorted by date with upcoming events first. Key capabilities: - EventCard with title, relative time display, and organizer/attendee role badge - Sortable EventList with past-event visual distinction (faded style) - Empty state when no events are stored - Swipe-to-delete gesture with confirmation dialog - Floating action button for quick event creation - Rename router param :token → :eventToken across all views - useRelativeTime composable (Intl.RelativeTimeFormat) - useEventStorage: add validation, removeEvent(), reactive versioning - Full E2E and unit test coverage for all new components Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
959 B
TypeScript
36 lines
959 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { createRouter, createMemoryHistory } from 'vue-router'
|
|
import EmptyState from '../EmptyState.vue'
|
|
|
|
const router = createRouter({
|
|
history: createMemoryHistory(),
|
|
routes: [
|
|
{ path: '/', component: { template: '<div />' } },
|
|
{ path: '/create', name: 'create', component: { template: '<div />' } },
|
|
],
|
|
})
|
|
|
|
function mountEmptyState() {
|
|
return mount(EmptyState, {
|
|
global: {
|
|
plugins: [router],
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('EmptyState', () => {
|
|
it('renders an inviting message', () => {
|
|
const wrapper = mountEmptyState()
|
|
expect(wrapper.text()).toContain('No events yet')
|
|
})
|
|
|
|
it('renders a Create Event link', () => {
|
|
const wrapper = mountEmptyState()
|
|
const link = wrapper.find('a')
|
|
expect(link.exists()).toBe(true)
|
|
expect(link.text()).toContain('Create Event')
|
|
expect(link.attributes('href')).toBe('/create')
|
|
})
|
|
})
|