StageRow.test.ts (5): - renders one PerformanceBlock per performance - lane_resolved drives vertical stacking (different lanes → different topPx) - empty stage row renders zero blocks - horizontal position = (start_at - gridStart) × pxPerMin (60 min × 2 = 120px) - block-pointerdown event bubbles up as blockPointerdown Wachtrij.test.ts (5): - one card per parked performance - empty wachtrij shows "Geen optredens" copy - card pointerdown emits cardPointerdown with the parked performance - card click emits cardSelect with the performance + DOMRect - count badge reflects performances.length Test count: 350 → 360. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { mountWithVuexy } from '../utils/mountWithVuexy'
|
|
import Wachtrij from '@/components/timetable/Wachtrij.vue'
|
|
import { ArtistEngagementStatus, type Performance } from '@/types/timetable'
|
|
|
|
function parked(id: string, name: string, status = ArtistEngagementStatus.REQUESTED): Performance {
|
|
return {
|
|
id,
|
|
engagement_id: `e_${id}`,
|
|
event_id: 'ev1',
|
|
stage_id: null,
|
|
lane: 0,
|
|
lane_resolved: 0,
|
|
start_at: null,
|
|
end_at: null,
|
|
version: 1,
|
|
notes: null,
|
|
warnings: [],
|
|
engagement: {
|
|
booking_status: { value: status, label: status },
|
|
artist: { name } as Performance['engagement']['artist'],
|
|
} as Performance['engagement'],
|
|
stage: null,
|
|
created_at: null,
|
|
updated_at: null,
|
|
deleted_at: null,
|
|
}
|
|
}
|
|
|
|
describe('Wachtrij — parked-card list', () => {
|
|
it('renders one card per parked performance', () => {
|
|
const { wrapper } = mountWithVuexy(Wachtrij, {
|
|
props: {
|
|
performances: [parked('p1', 'Devin Wild'), parked('p2', 'Da Tweekaz')],
|
|
selectedId: null,
|
|
},
|
|
})
|
|
|
|
expect(wrapper.findAll('[data-perf-id]')).toHaveLength(2)
|
|
})
|
|
|
|
it('renders the empty-state copy when no performances are parked', () => {
|
|
const { wrapper } = mountWithVuexy(Wachtrij, {
|
|
props: { performances: [], selectedId: null },
|
|
})
|
|
|
|
expect(wrapper.text()).toMatch(/Geen optredens/i)
|
|
})
|
|
|
|
it('forwards a card pointerdown as cardPointerdown', async () => {
|
|
const { wrapper } = mountWithVuexy(Wachtrij, {
|
|
props: {
|
|
performances: [parked('p1', 'Devin Wild')],
|
|
selectedId: null,
|
|
},
|
|
})
|
|
|
|
await wrapper.find('[data-perf-id="p1"]').trigger('pointerdown')
|
|
|
|
expect(wrapper.emitted('cardPointerdown')).toHaveLength(1)
|
|
})
|
|
|
|
it('forwards a card click as cardSelect with performance + DOMRect', async () => {
|
|
const { wrapper } = mountWithVuexy(Wachtrij, {
|
|
props: {
|
|
performances: [parked('p1', 'Devin Wild')],
|
|
selectedId: null,
|
|
},
|
|
})
|
|
|
|
await wrapper.find('[data-perf-id="p1"]').trigger('click')
|
|
|
|
const events = wrapper.emitted('cardSelect')
|
|
|
|
expect(events).toHaveLength(1)
|
|
expect(events![0][0]).toMatchObject({ id: 'p1' })
|
|
})
|
|
|
|
it('shows the wachtrij item count badge', () => {
|
|
const { wrapper } = mountWithVuexy(Wachtrij, {
|
|
props: {
|
|
performances: [parked('a', 'A'), parked('b', 'B'), parked('c', 'C')],
|
|
selectedId: null,
|
|
},
|
|
})
|
|
|
|
expect(wrapper.find('.tt-wachtrij__count').text()).toBe('3')
|
|
})
|
|
})
|