Add event list feature (009-list-events)
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>
This commit is contained in:
151
frontend/src/components/ConfirmDialog.vue
Normal file
151
frontend/src/components/ConfirmDialog.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="confirm-dialog">
|
||||
<div v-if="open" class="confirm-dialog__overlay" @click.self="$emit('cancel')">
|
||||
<div
|
||||
class="confirm-dialog"
|
||||
role="alertdialog"
|
||||
aria-modal="true"
|
||||
:aria-label="title"
|
||||
@keydown.escape="$emit('cancel')"
|
||||
>
|
||||
<p class="confirm-dialog__title">{{ title }}</p>
|
||||
<p class="confirm-dialog__message">{{ message }}</p>
|
||||
<div class="confirm-dialog__actions">
|
||||
<button
|
||||
ref="cancelBtn"
|
||||
class="confirm-dialog__btn confirm-dialog__btn--cancel"
|
||||
type="button"
|
||||
@click="$emit('cancel')"
|
||||
>
|
||||
{{ cancelLabel }}
|
||||
</button>
|
||||
<button
|
||||
class="confirm-dialog__btn confirm-dialog__btn--confirm"
|
||||
type="button"
|
||||
@click="$emit('confirm')"
|
||||
>
|
||||
{{ confirmLabel }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, nextTick } from 'vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
open: boolean
|
||||
title?: string
|
||||
message?: string
|
||||
confirmLabel?: string
|
||||
cancelLabel?: string
|
||||
}>(),
|
||||
{
|
||||
title: 'Are you sure?',
|
||||
message: '',
|
||||
confirmLabel: 'Remove',
|
||||
cancelLabel: 'Cancel',
|
||||
},
|
||||
)
|
||||
|
||||
defineEmits<{
|
||||
confirm: []
|
||||
cancel: []
|
||||
}>()
|
||||
|
||||
const cancelBtn = ref<HTMLButtonElement | null>(null)
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
async (isOpen) => {
|
||||
if (isOpen) {
|
||||
await nextTick()
|
||||
cancelBtn.value?.focus()
|
||||
}
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.confirm-dialog__overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
padding: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.confirm-dialog {
|
||||
background: var(--color-card);
|
||||
border-radius: var(--radius-card);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
padding: var(--spacing-xl);
|
||||
max-width: 320px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.confirm-dialog__title {
|
||||
font-size: 1.05rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.confirm-dialog__message {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 400;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.confirm-dialog__actions {
|
||||
display: flex;
|
||||
gap: var(--spacing-sm);
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.confirm-dialog__btn {
|
||||
padding: 0.5rem 1rem;
|
||||
border: none;
|
||||
border-radius: var(--radius-button);
|
||||
font-family: inherit;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.confirm-dialog__btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.confirm-dialog__btn--cancel {
|
||||
background: #e8e8e8;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.confirm-dialog__btn--confirm {
|
||||
background: #d32f2f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.confirm-dialog-enter-active,
|
||||
.confirm-dialog-leave-active {
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.confirm-dialog-enter-from,
|
||||
.confirm-dialog-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
49
frontend/src/components/CreateEventFab.vue
Normal file
49
frontend/src/components/CreateEventFab.vue
Normal file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<RouterLink to="/create" class="fab" aria-label="Create event">
|
||||
<span class="fab__icon" aria-hidden="true">+</span>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RouterLink } from 'vue-router'
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fab {
|
||||
position: fixed;
|
||||
bottom: calc(1.2rem + env(safe-area-inset-bottom));
|
||||
right: 1.2rem;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-accent);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
|
||||
text-decoration: none;
|
||||
z-index: 100;
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
.fab:hover {
|
||||
transform: scale(1.08);
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.fab:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.fab:focus-visible {
|
||||
outline: 2px solid #fff;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.fab__icon {
|
||||
font-size: 1.8rem;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
31
frontend/src/components/EmptyState.vue
Normal file
31
frontend/src/components/EmptyState.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div class="empty-state">
|
||||
<p class="empty-state__message">No events yet.<br />Create your first one!</p>
|
||||
<RouterLink to="/create" class="btn-primary empty-state__cta">+ Create Event</RouterLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RouterLink } from 'vue-router'
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.empty-state__message {
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
color: var(--color-text-on-gradient);
|
||||
opacity: 0.9;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-state__cta {
|
||||
max-width: 280px;
|
||||
}
|
||||
</style>
|
||||
172
frontend/src/components/EventCard.vue
Normal file
172
frontend/src/components/EventCard.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div
|
||||
class="event-card"
|
||||
:class="{ 'event-card--past': isPast, 'event-card--swiping': isSwiping }"
|
||||
:style="swipeStyle"
|
||||
@touchstart="onTouchStart"
|
||||
@touchmove="onTouchMove"
|
||||
@touchend="onTouchEnd"
|
||||
>
|
||||
<RouterLink :to="`/events/${eventToken}`" class="event-card__link">
|
||||
<span class="event-card__title">{{ title }}</span>
|
||||
<span class="event-card__time">{{ relativeTime }}</span>
|
||||
</RouterLink>
|
||||
<span v-if="eventRole" class="event-card__badge" :class="`event-card__badge--${eventRole}`">
|
||||
{{ eventRole === 'organizer' ? 'Organizer' : 'Attendee' }}
|
||||
</span>
|
||||
<button
|
||||
class="event-card__delete"
|
||||
type="button"
|
||||
:aria-label="`Remove ${title}`"
|
||||
@click.stop="$emit('delete', eventToken)"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
||||
const props = defineProps<{
|
||||
eventToken: string
|
||||
title: string
|
||||
relativeTime: string
|
||||
isPast: boolean
|
||||
eventRole?: 'organizer' | 'attendee'
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
delete: [eventToken: string]
|
||||
}>()
|
||||
|
||||
const SWIPE_THRESHOLD = 80
|
||||
|
||||
const startX = ref(0)
|
||||
const deltaX = ref(0)
|
||||
const isSwiping = ref(false)
|
||||
|
||||
const swipeStyle = computed(() => {
|
||||
if (deltaX.value === 0) return {}
|
||||
return { transform: `translateX(${deltaX.value}px)` }
|
||||
})
|
||||
|
||||
function onTouchStart(e: TouchEvent) {
|
||||
const touch = e.touches[0]
|
||||
if (!touch) return
|
||||
startX.value = touch.clientX
|
||||
deltaX.value = 0
|
||||
isSwiping.value = false
|
||||
}
|
||||
|
||||
function onTouchMove(e: TouchEvent) {
|
||||
const touch = e.touches[0]
|
||||
if (!touch) return
|
||||
const diff = touch.clientX - startX.value
|
||||
// Only allow leftward swipe
|
||||
if (diff < 0) {
|
||||
deltaX.value = diff
|
||||
isSwiping.value = true
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
if (deltaX.value < -SWIPE_THRESHOLD) {
|
||||
emit('delete', props.eventToken)
|
||||
}
|
||||
deltaX.value = 0
|
||||
isSwiping.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.event-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: var(--color-card);
|
||||
border-radius: var(--radius-card);
|
||||
box-shadow: var(--shadow-card);
|
||||
padding: var(--spacing-md) var(--spacing-lg);
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.event-card--past {
|
||||
opacity: 0.6;
|
||||
filter: saturate(0.5);
|
||||
}
|
||||
|
||||
.event-card:not(.event-card--swiping) {
|
||||
transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.event-card__link {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.event-card__title {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.event-card__time {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 400;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.event-card__badge {
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.event-card__badge--organizer {
|
||||
background: var(--color-accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.event-card__badge--attendee {
|
||||
background: #e0e0e0;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.event-card__delete {
|
||||
flex-shrink: 0;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.2rem;
|
||||
color: #bbb;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
transition: color 0.15s ease, background 0.15s ease;
|
||||
}
|
||||
|
||||
.event-card__delete:hover {
|
||||
color: #d32f2f;
|
||||
background: rgba(211, 47, 47, 0.08);
|
||||
}
|
||||
|
||||
.event-card__delete:focus-visible {
|
||||
outline: 2px solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
79
frontend/src/components/EventList.vue
Normal file
79
frontend/src/components/EventList.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="event-list" role="list" aria-label="Your events">
|
||||
<div v-for="event in sortedEvents" :key="event.eventToken" role="listitem">
|
||||
<EventCard
|
||||
:event-token="event.eventToken"
|
||||
:title="event.title"
|
||||
:relative-time="formatRelativeTime(event.dateTime)"
|
||||
:is-past="isPast(event.dateTime)"
|
||||
:event-role="getRole(event)"
|
||||
@delete="requestDelete"
|
||||
/>
|
||||
</div>
|
||||
<ConfirmDialog
|
||||
:open="!!pendingDeleteToken"
|
||||
title="Remove event?"
|
||||
message="This event will be removed from your list."
|
||||
confirm-label="Remove"
|
||||
cancel-label="Cancel"
|
||||
@confirm="confirmDelete"
|
||||
@cancel="cancelDelete"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { useEventStorage, isValidStoredEvent } from '../composables/useEventStorage'
|
||||
import { formatRelativeTime } from '../composables/useRelativeTime'
|
||||
import EventCard from './EventCard.vue'
|
||||
import ConfirmDialog from './ConfirmDialog.vue'
|
||||
import type { StoredEvent } from '../composables/useEventStorage'
|
||||
|
||||
const { getStoredEvents, removeEvent } = useEventStorage()
|
||||
|
||||
const pendingDeleteToken = ref<string | null>(null)
|
||||
|
||||
function requestDelete(eventToken: string) {
|
||||
pendingDeleteToken.value = eventToken
|
||||
}
|
||||
|
||||
function confirmDelete() {
|
||||
if (pendingDeleteToken.value) {
|
||||
removeEvent(pendingDeleteToken.value)
|
||||
}
|
||||
pendingDeleteToken.value = null
|
||||
}
|
||||
|
||||
function cancelDelete() {
|
||||
pendingDeleteToken.value = null
|
||||
}
|
||||
|
||||
function isPast(dateTime: string): boolean {
|
||||
return new Date(dateTime) < new Date()
|
||||
}
|
||||
|
||||
function getRole(event: StoredEvent): 'organizer' | 'attendee' | undefined {
|
||||
if (event.organizerToken) return 'organizer'
|
||||
if (event.rsvpToken) return 'attendee'
|
||||
return undefined
|
||||
}
|
||||
|
||||
const sortedEvents = computed(() => {
|
||||
const valid = getStoredEvents().filter(isValidStoredEvent)
|
||||
const now = new Date()
|
||||
const upcoming = valid.filter((e) => new Date(e.dateTime) >= now)
|
||||
const past = valid.filter((e) => new Date(e.dateTime) < now)
|
||||
upcoming.sort((a, b) => new Date(a.dateTime).getTime() - new Date(b.dateTime).getTime())
|
||||
past.sort((a, b) => new Date(b.dateTime).getTime() - new Date(a.dateTime).getTime())
|
||||
return [...upcoming, ...past]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.event-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
</style>
|
||||
111
frontend/src/components/__tests__/ConfirmDialog.spec.ts
Normal file
111
frontend/src/components/__tests__/ConfirmDialog.spec.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import { describe, it, expect, afterEach } from 'vitest'
|
||||
import { mount, VueWrapper } from '@vue/test-utils'
|
||||
import ConfirmDialog from '../ConfirmDialog.vue'
|
||||
|
||||
let wrapper: VueWrapper
|
||||
|
||||
function mountDialog(props: Record<string, unknown> = {}) {
|
||||
wrapper = mount(ConfirmDialog, {
|
||||
props: {
|
||||
open: true,
|
||||
...props,
|
||||
},
|
||||
attachTo: document.body,
|
||||
})
|
||||
return wrapper
|
||||
}
|
||||
|
||||
function dialog() {
|
||||
return document.body.querySelector('.confirm-dialog')
|
||||
}
|
||||
|
||||
function overlay() {
|
||||
return document.body.querySelector('.confirm-dialog__overlay')
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
})
|
||||
|
||||
describe('ConfirmDialog', () => {
|
||||
it('renders when open is true', () => {
|
||||
mountDialog()
|
||||
expect(dialog()).not.toBeNull()
|
||||
})
|
||||
|
||||
it('does not render when open is false', () => {
|
||||
mountDialog({ open: false })
|
||||
expect(dialog()).toBeNull()
|
||||
})
|
||||
|
||||
it('displays default title', () => {
|
||||
mountDialog()
|
||||
expect(dialog()!.querySelector('.confirm-dialog__title')!.textContent).toBe('Are you sure?')
|
||||
})
|
||||
|
||||
it('displays custom title and message', () => {
|
||||
mountDialog({
|
||||
title: 'Remove event?',
|
||||
message: 'This cannot be undone.',
|
||||
})
|
||||
expect(dialog()!.querySelector('.confirm-dialog__title')!.textContent).toBe('Remove event?')
|
||||
expect(dialog()!.querySelector('.confirm-dialog__message')!.textContent).toBe('This cannot be undone.')
|
||||
})
|
||||
|
||||
it('displays custom button labels', () => {
|
||||
mountDialog({
|
||||
confirmLabel: 'Delete',
|
||||
cancelLabel: 'Keep',
|
||||
})
|
||||
const buttons = dialog()!.querySelectorAll('.confirm-dialog__btn')
|
||||
expect(buttons[0]!.textContent!.trim()).toBe('Keep')
|
||||
expect(buttons[1]!.textContent!.trim()).toBe('Delete')
|
||||
})
|
||||
|
||||
it('emits confirm when confirm button is clicked', async () => {
|
||||
mountDialog()
|
||||
const btn = dialog()!.querySelector('.confirm-dialog__btn--confirm') as HTMLElement
|
||||
btn.click()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.emitted('confirm')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('emits cancel when cancel button is clicked', async () => {
|
||||
mountDialog()
|
||||
const btn = dialog()!.querySelector('.confirm-dialog__btn--cancel') as HTMLElement
|
||||
btn.click()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.emitted('cancel')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('emits cancel when overlay is clicked', async () => {
|
||||
mountDialog()
|
||||
const el = overlay() as HTMLElement
|
||||
el.click()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.emitted('cancel')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('emits cancel when Escape key is pressed', async () => {
|
||||
mountDialog()
|
||||
const el = dialog() as HTMLElement
|
||||
el.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.emitted('cancel')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('focuses cancel button when opened', async () => {
|
||||
mountDialog({ open: false })
|
||||
await wrapper.setProps({ open: true })
|
||||
await wrapper.vm.$nextTick()
|
||||
const cancelBtn = dialog()!.querySelector('.confirm-dialog__btn--cancel')
|
||||
expect(document.activeElement).toBe(cancelBtn)
|
||||
})
|
||||
|
||||
it('has alertdialog role and aria-modal', () => {
|
||||
mountDialog()
|
||||
const el = dialog() as HTMLElement
|
||||
expect(el.getAttribute('role')).toBe('alertdialog')
|
||||
expect(el.getAttribute('aria-modal')).toBe('true')
|
||||
})
|
||||
})
|
||||
35
frontend/src/components/__tests__/EmptyState.spec.ts
Normal file
35
frontend/src/components/__tests__/EmptyState.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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')
|
||||
})
|
||||
})
|
||||
76
frontend/src/components/__tests__/EventCard.spec.ts
Normal file
76
frontend/src/components/__tests__/EventCard.spec.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createRouter, createMemoryHistory } from 'vue-router'
|
||||
import EventCard from '../EventCard.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{ path: '/', component: { template: '<div />' } },
|
||||
{ path: '/events/:eventToken', name: 'event', component: { template: '<div />' } },
|
||||
],
|
||||
})
|
||||
|
||||
function mountCard(props: Record<string, unknown> = {}) {
|
||||
return mount(EventCard, {
|
||||
props: {
|
||||
eventToken: 'abc-123',
|
||||
title: 'Birthday Party',
|
||||
relativeTime: 'in 3 days',
|
||||
isPast: false,
|
||||
...props,
|
||||
},
|
||||
global: {
|
||||
plugins: [router],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
describe('EventCard', () => {
|
||||
it('renders the event title', () => {
|
||||
const wrapper = mountCard()
|
||||
expect(wrapper.text()).toContain('Birthday Party')
|
||||
})
|
||||
|
||||
it('renders relative time', () => {
|
||||
const wrapper = mountCard({ relativeTime: 'yesterday' })
|
||||
expect(wrapper.text()).toContain('yesterday')
|
||||
})
|
||||
|
||||
it('links to the event detail page', () => {
|
||||
const wrapper = mountCard({ eventToken: 'xyz-789' })
|
||||
const link = wrapper.find('a')
|
||||
expect(link.attributes('href')).toBe('/events/xyz-789')
|
||||
})
|
||||
|
||||
it('applies past modifier class when isPast is true', () => {
|
||||
const wrapper = mountCard({ isPast: true })
|
||||
expect(wrapper.find('.event-card--past').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('does not apply past modifier class when isPast is false', () => {
|
||||
const wrapper = mountCard({ isPast: false })
|
||||
expect(wrapper.find('.event-card--past').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('renders organizer badge when eventRole is organizer', () => {
|
||||
const wrapper = mountCard({ eventRole: 'organizer' })
|
||||
expect(wrapper.text()).toContain('Organizer')
|
||||
})
|
||||
|
||||
it('renders attendee badge when eventRole is attendee', () => {
|
||||
const wrapper = mountCard({ eventRole: 'attendee' })
|
||||
expect(wrapper.text()).toContain('Attendee')
|
||||
})
|
||||
|
||||
it('renders no badge when eventRole is undefined', () => {
|
||||
const wrapper = mountCard({ eventRole: undefined })
|
||||
expect(wrapper.find('.event-card__badge').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('emits delete event with eventToken when delete button is clicked', async () => {
|
||||
const wrapper = mountCard({ eventToken: 'abc-123' })
|
||||
await wrapper.find('.event-card__delete').trigger('click')
|
||||
expect(wrapper.emitted('delete')).toEqual([['abc-123']])
|
||||
})
|
||||
})
|
||||
79
frontend/src/components/__tests__/EventList.spec.ts
Normal file
79
frontend/src/components/__tests__/EventList.spec.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createRouter, createMemoryHistory } from 'vue-router'
|
||||
import EventList from '../EventList.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{ path: '/', component: { template: '<div />' } },
|
||||
{ path: '/events/:eventToken', name: 'event', component: { template: '<div />' } },
|
||||
],
|
||||
})
|
||||
|
||||
const mockEvents = [
|
||||
{ eventToken: 'past-1', title: 'Past Event', dateTime: '2025-01-01T10:00:00Z', expiryDate: '' },
|
||||
{ eventToken: 'future-1', title: 'Future Event', dateTime: '2027-06-15T10:00:00Z', expiryDate: '' },
|
||||
{ eventToken: 'future-2', title: 'Soon Event', dateTime: '2027-01-01T10:00:00Z', expiryDate: '' },
|
||||
]
|
||||
|
||||
vi.mock('../../composables/useEventStorage', () => ({
|
||||
isValidStoredEvent: (e: unknown) => {
|
||||
if (typeof e !== 'object' || e === null) return false
|
||||
const obj = e as Record<string, unknown>
|
||||
return typeof obj.eventToken === 'string' && obj.eventToken.length > 0
|
||||
&& typeof obj.title === 'string' && obj.title.length > 0
|
||||
&& typeof obj.dateTime === 'string' && obj.dateTime.length > 0
|
||||
},
|
||||
useEventStorage: () => ({
|
||||
getStoredEvents: () => mockEvents,
|
||||
removeEvent: vi.fn(),
|
||||
}),
|
||||
}))
|
||||
|
||||
vi.mock('../../composables/useRelativeTime', () => ({
|
||||
formatRelativeTime: (dateTime: string) => {
|
||||
if (dateTime.startsWith('2025')) return '1 year ago'
|
||||
if (dateTime.includes('06-15')) return 'in 1 year'
|
||||
return 'in 10 months'
|
||||
},
|
||||
}))
|
||||
|
||||
function mountList() {
|
||||
return mount(EventList, {
|
||||
global: { plugins: [router] },
|
||||
})
|
||||
}
|
||||
|
||||
describe('EventList', () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(new Date('2026-03-08T12:00:00Z'))
|
||||
})
|
||||
|
||||
it('renders all valid events', () => {
|
||||
const wrapper = mountList()
|
||||
const cards = wrapper.findAll('.event-card')
|
||||
expect(cards).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('sorts upcoming events before past events', () => {
|
||||
const wrapper = mountList()
|
||||
const titles = wrapper.findAll('.event-card__title').map((el) => el.text())
|
||||
// Upcoming events first (sorted ascending), then past events
|
||||
expect(titles[0]).toBe('Soon Event')
|
||||
expect(titles[1]).toBe('Future Event')
|
||||
expect(titles[2]).toBe('Past Event')
|
||||
})
|
||||
|
||||
it('marks past events with isPast class', () => {
|
||||
const wrapper = mountList()
|
||||
const cards = wrapper.findAll('.event-card')
|
||||
expect(cards).toHaveLength(3)
|
||||
// Last card should be past
|
||||
expect(cards[2]!.classes()).toContain('event-card--past')
|
||||
// First two should not be past
|
||||
expect(cards[0]!.classes()).not.toContain('event-card--past')
|
||||
expect(cards[1]!.classes()).not.toContain('event-card--past')
|
||||
})
|
||||
})
|
||||
@@ -164,4 +164,120 @@ describe('useEventStorage', () => {
|
||||
const { getRsvp } = useEventStorage()
|
||||
expect(getRsvp('unknown')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('removes an event by token', () => {
|
||||
const { saveCreatedEvent, getStoredEvents, removeEvent } = useEventStorage()
|
||||
|
||||
saveCreatedEvent({
|
||||
eventToken: 'event-1',
|
||||
title: 'First',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
expiryDate: '2026-07-15',
|
||||
})
|
||||
|
||||
saveCreatedEvent({
|
||||
eventToken: 'event-2',
|
||||
title: 'Second',
|
||||
dateTime: '2026-07-15T20:00:00+02:00',
|
||||
expiryDate: '2026-08-15',
|
||||
})
|
||||
|
||||
removeEvent('event-1')
|
||||
|
||||
const events = getStoredEvents()
|
||||
expect(events).toHaveLength(1)
|
||||
expect(events[0]!.eventToken).toBe('event-2')
|
||||
})
|
||||
|
||||
it('removeEvent does nothing for unknown token', () => {
|
||||
const { saveCreatedEvent, getStoredEvents, removeEvent } = useEventStorage()
|
||||
|
||||
saveCreatedEvent({
|
||||
eventToken: 'event-1',
|
||||
title: 'First',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
expiryDate: '2026-07-15',
|
||||
})
|
||||
|
||||
removeEvent('nonexistent')
|
||||
|
||||
expect(getStoredEvents()).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('isValidStoredEvent', () => {
|
||||
// Import directly since it's an exported function
|
||||
let isValidStoredEvent: (e: unknown) => boolean
|
||||
|
||||
beforeEach(async () => {
|
||||
const mod = await import('../useEventStorage')
|
||||
isValidStoredEvent = mod.isValidStoredEvent
|
||||
})
|
||||
|
||||
it('returns true for a valid event', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
eventToken: 'abc-123',
|
||||
title: 'Birthday',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
expiryDate: '2026-07-15',
|
||||
}),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false for null', () => {
|
||||
expect(isValidStoredEvent(null)).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false for non-object', () => {
|
||||
expect(isValidStoredEvent('string')).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when eventToken is missing', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
title: 'Birthday',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when eventToken is empty', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
eventToken: '',
|
||||
title: 'Birthday',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when title is missing', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
eventToken: 'abc-123',
|
||||
dateTime: '2026-06-15T20:00:00+02:00',
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when dateTime is invalid', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
eventToken: 'abc-123',
|
||||
title: 'Birthday',
|
||||
dateTime: 'not-a-date',
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when dateTime is empty', () => {
|
||||
expect(
|
||||
isValidStoredEvent({
|
||||
eventToken: 'abc-123',
|
||||
title: 'Birthday',
|
||||
dateTime: '',
|
||||
}),
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
72
frontend/src/composables/__tests__/useRelativeTime.spec.ts
Normal file
72
frontend/src/composables/__tests__/useRelativeTime.spec.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { formatRelativeTime } from '../useRelativeTime'
|
||||
|
||||
describe('formatRelativeTime', () => {
|
||||
const now = new Date('2026-06-15T12:00:00Z')
|
||||
|
||||
it('formats seconds ago', () => {
|
||||
const result = formatRelativeTime('2026-06-15T11:59:30Z', now)
|
||||
expect(result).toMatch(/30 seconds ago/)
|
||||
})
|
||||
|
||||
it('formats minutes ago', () => {
|
||||
const result = formatRelativeTime('2026-06-15T11:55:00Z', now)
|
||||
expect(result).toMatch(/5 minutes ago/)
|
||||
})
|
||||
|
||||
it('formats hours ago', () => {
|
||||
const result = formatRelativeTime('2026-06-15T09:00:00Z', now)
|
||||
expect(result).toMatch(/3 hours ago/)
|
||||
})
|
||||
|
||||
it('formats days ago', () => {
|
||||
const result = formatRelativeTime('2026-06-13T12:00:00Z', now)
|
||||
expect(result).toMatch(/2 days ago/)
|
||||
})
|
||||
|
||||
it('formats weeks ago', () => {
|
||||
const result = formatRelativeTime('2026-06-01T12:00:00Z', now)
|
||||
expect(result).toMatch(/2 weeks ago/)
|
||||
})
|
||||
|
||||
it('formats months ago', () => {
|
||||
const result = formatRelativeTime('2026-03-15T12:00:00Z', now)
|
||||
expect(result).toMatch(/3 months ago/)
|
||||
})
|
||||
|
||||
it('formats years ago', () => {
|
||||
const result = formatRelativeTime('2024-06-15T12:00:00Z', now)
|
||||
expect(result).toMatch(/2 years ago/)
|
||||
})
|
||||
|
||||
it('formats future seconds', () => {
|
||||
const result = formatRelativeTime('2026-06-15T12:00:30Z', now)
|
||||
expect(result).toMatch(/in 30 seconds/)
|
||||
})
|
||||
|
||||
it('formats future days', () => {
|
||||
const result = formatRelativeTime('2026-06-18T12:00:00Z', now)
|
||||
expect(result).toMatch(/in 3 days/)
|
||||
})
|
||||
|
||||
it('formats future months', () => {
|
||||
const result = formatRelativeTime('2026-09-15T12:00:00Z', now)
|
||||
expect(result).toMatch(/in 3 months/)
|
||||
})
|
||||
|
||||
it('formats "now" for zero difference', () => {
|
||||
const result = formatRelativeTime('2026-06-15T12:00:00Z', now)
|
||||
// Intl.RelativeTimeFormat with numeric: 'auto' returns "now" for 0 seconds
|
||||
expect(result).toMatch(/now/)
|
||||
})
|
||||
|
||||
it('formats yesterday', () => {
|
||||
const result = formatRelativeTime('2026-06-14T12:00:00Z', now)
|
||||
expect(result).toMatch(/yesterday|1 day ago/)
|
||||
})
|
||||
|
||||
it('formats tomorrow', () => {
|
||||
const result = formatRelativeTime('2026-06-16T12:00:00Z', now)
|
||||
expect(result).toMatch(/tomorrow|in 1 day/)
|
||||
})
|
||||
})
|
||||
@@ -8,8 +8,26 @@ export interface StoredEvent {
|
||||
rsvpName?: string
|
||||
}
|
||||
|
||||
import { ref } from 'vue'
|
||||
|
||||
const STORAGE_KEY = 'fete:events'
|
||||
|
||||
const version = ref(0)
|
||||
|
||||
export function isValidStoredEvent(e: unknown): e is StoredEvent {
|
||||
if (typeof e !== 'object' || e === null) return false
|
||||
const obj = e as Record<string, unknown>
|
||||
return (
|
||||
typeof obj.eventToken === 'string' &&
|
||||
obj.eventToken.length > 0 &&
|
||||
typeof obj.title === 'string' &&
|
||||
obj.title.length > 0 &&
|
||||
typeof obj.dateTime === 'string' &&
|
||||
obj.dateTime.length > 0 &&
|
||||
!isNaN(new Date(obj.dateTime).getTime())
|
||||
)
|
||||
}
|
||||
|
||||
function readEvents(): StoredEvent[] {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_KEY)
|
||||
@@ -21,6 +39,7 @@ function readEvents(): StoredEvent[] {
|
||||
|
||||
function writeEvents(events: StoredEvent[]): void {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(events))
|
||||
version.value++
|
||||
}
|
||||
|
||||
export function useEventStorage() {
|
||||
@@ -31,6 +50,7 @@ export function useEventStorage() {
|
||||
}
|
||||
|
||||
function getStoredEvents(): StoredEvent[] {
|
||||
void version.value
|
||||
return readEvents()
|
||||
}
|
||||
|
||||
@@ -59,5 +79,10 @@ export function useEventStorage() {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return { saveCreatedEvent, getStoredEvents, getOrganizerToken, saveRsvp, getRsvp }
|
||||
function removeEvent(eventToken: string): void {
|
||||
const events = readEvents().filter((e) => e.eventToken !== eventToken)
|
||||
writeEvents(events)
|
||||
}
|
||||
|
||||
return { saveCreatedEvent, getStoredEvents, getOrganizerToken, saveRsvp, getRsvp, removeEvent }
|
||||
}
|
||||
|
||||
23
frontend/src/composables/useRelativeTime.ts
Normal file
23
frontend/src/composables/useRelativeTime.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
const UNITS: [Intl.RelativeTimeFormatUnit, number][] = [
|
||||
['year', 365 * 24 * 60 * 60],
|
||||
['month', 30 * 24 * 60 * 60],
|
||||
['week', 7 * 24 * 60 * 60],
|
||||
['day', 24 * 60 * 60],
|
||||
['hour', 60 * 60],
|
||||
['minute', 60],
|
||||
['second', 1],
|
||||
]
|
||||
|
||||
export function formatRelativeTime(dateTime: string, now: Date = new Date()): string {
|
||||
const target = new Date(dateTime)
|
||||
const diffSeconds = Math.round((target.getTime() - now.getTime()) / 1000)
|
||||
|
||||
for (const [unit, secondsInUnit] of UNITS) {
|
||||
if (Math.abs(diffSeconds) >= secondsInUnit) {
|
||||
const value = Math.round(diffSeconds / secondsInUnit)
|
||||
return new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' }).format(value, unit)
|
||||
}
|
||||
}
|
||||
|
||||
return new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' }).format(0, 'second')
|
||||
}
|
||||
@@ -15,7 +15,7 @@ const router = createRouter({
|
||||
component: () => import('../views/EventCreateView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/events/:token',
|
||||
path: '/events/:eventToken',
|
||||
name: 'event',
|
||||
component: () => import('../views/EventDetailView.vue'),
|
||||
},
|
||||
|
||||
@@ -215,7 +215,7 @@ async function handleSubmit() {
|
||||
expiryDate: data.expiryDate,
|
||||
})
|
||||
|
||||
router.push({ name: 'event', params: { token: data.eventToken } })
|
||||
router.push({ name: 'event', params: { eventToken: data.eventToken } })
|
||||
}
|
||||
} catch {
|
||||
submitting.value = false
|
||||
|
||||
@@ -131,7 +131,7 @@ async function fetchEvent() {
|
||||
|
||||
try {
|
||||
const { data, error, response } = await api.GET('/events/{token}', {
|
||||
params: { path: { token: route.params.token as string } },
|
||||
params: { path: { token: route.params.eventToken as string } },
|
||||
})
|
||||
|
||||
if (error) {
|
||||
@@ -173,7 +173,7 @@ async function submitRsvp() {
|
||||
|
||||
try {
|
||||
const { data, error } = await api.POST('/events/{token}/rsvps', {
|
||||
params: { path: { token: route.params.token as string } },
|
||||
params: { path: { token: route.params.eventToken as string } },
|
||||
body: { name: nameInput.value },
|
||||
})
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const route = useRoute()
|
||||
const copyState = ref<'idle' | 'copied' | 'failed'>('idle')
|
||||
|
||||
const eventUrl = computed(() => {
|
||||
return window.location.origin + '/events/' + route.params.token
|
||||
return window.location.origin + '/events/' + route.params.eventToken
|
||||
})
|
||||
|
||||
const copyLabel = computed(() => {
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
<template>
|
||||
<main class="home">
|
||||
<h1 class="home__title">fete</h1>
|
||||
<p class="home__subtitle">No events yet.<br />Create your first one!</p>
|
||||
<RouterLink to="/create" class="btn-primary home__cta">+ Create Event</RouterLink>
|
||||
<template v-if="events.length > 0">
|
||||
<EventList />
|
||||
<CreateEventFab />
|
||||
</template>
|
||||
<template v-else>
|
||||
<EmptyState />
|
||||
</template>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { computed } from 'vue'
|
||||
import { useEventStorage, isValidStoredEvent } from '../composables/useEventStorage'
|
||||
import EventList from '../components/EventList.vue'
|
||||
import EmptyState from '../components/EmptyState.vue'
|
||||
import CreateEventFab from '../components/CreateEventFab.vue'
|
||||
|
||||
const { getStoredEvents } = useEventStorage()
|
||||
|
||||
const events = computed(() => getStoredEvents().filter(isValidStoredEvent))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -15,27 +28,15 @@ import { RouterLink } from 'vue-router'
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--spacing-lg);
|
||||
text-align: center;
|
||||
padding-top: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.home__title {
|
||||
font-size: 2rem;
|
||||
font-weight: 800;
|
||||
color: var(--color-text-on-gradient);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.home__subtitle {
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
color: var(--color-text-on-gradient);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.home__cta {
|
||||
margin-top: var(--spacing-md);
|
||||
max-width: 280px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -25,7 +25,7 @@ function createTestRouter() {
|
||||
routes: [
|
||||
{ path: '/', name: 'home', component: { template: '<div />' } },
|
||||
{ path: '/create', name: 'create-event', component: EventCreateView },
|
||||
{ path: '/events/:token', name: 'event', component: { template: '<div />' } },
|
||||
{ path: '/events/:eventToken', name: 'event', component: { template: '<div />' } },
|
||||
],
|
||||
})
|
||||
}
|
||||
@@ -169,6 +169,7 @@ describe('EventCreateView', () => {
|
||||
getOrganizerToken: vi.fn(),
|
||||
saveRsvp: vi.fn(),
|
||||
getRsvp: vi.fn(),
|
||||
removeEvent: vi.fn(),
|
||||
})
|
||||
|
||||
vi.mocked(api.POST).mockResolvedValueOnce({
|
||||
@@ -221,7 +222,7 @@ describe('EventCreateView', () => {
|
||||
|
||||
expect(pushSpy).toHaveBeenCalledWith({
|
||||
name: 'event',
|
||||
params: { token: 'abc-123' },
|
||||
params: { eventToken: 'abc-123' },
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ vi.mock('@/composables/useEventStorage', () => ({
|
||||
getOrganizerToken: mockGetOrganizerToken,
|
||||
saveRsvp: mockSaveRsvp,
|
||||
getRsvp: mockGetRsvp,
|
||||
removeEvent: vi.fn(),
|
||||
})),
|
||||
}))
|
||||
|
||||
@@ -30,7 +31,7 @@ function createTestRouter(_token?: string) {
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{ path: '/', name: 'home', component: { template: '<div />' } },
|
||||
{ path: '/events/:token', name: 'event', component: EventDetailView },
|
||||
{ path: '/events/:eventToken', name: 'event', component: EventDetailView },
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ function createTestRouter() {
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{ path: '/', name: 'home', component: { template: '<div />' } },
|
||||
{ path: '/events/:token', name: 'event', component: EventStubView },
|
||||
{ path: '/events/:eventToken', name: 'event', component: EventStubView },
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user