test: follow the note row's action wrapper and keep waitFor polling in the users refresh test

This commit is contained in:
Maurice
2026-10-14 12:18:39 +02:00
committed by Maurice
parent 3c8fa07f44
commit 723bfa507b
3 changed files with 14 additions and 9 deletions
@@ -1572,10 +1572,12 @@ describe('DayPlanSidebar', () => {
expect(document.querySelector('.note-edit-buttons')).toBeNull()
expect(row.querySelectorAll('[style*="position: absolute"]')).toHaveLength(0)
expect(row.querySelectorAll('.reorder-buttons button')).toHaveLength(2)
// Positional, not just by class: the reorder column sits at the row's right edge,
// with only the row's "…" after it.
expect(row.lastElementChild).toHaveAccessibleName('More options')
expect(row.lastElementChild?.previousElementSibling).toHaveClass('reorder-buttons')
// Positional, not just by class: the actions sit at the row's right edge,
// the reorder column with only the row's "…" after it.
const actions = row.lastElementChild
expect(actions).toHaveClass('dp-note-actions')
expect(actions?.lastElementChild).toHaveAccessibleName('More options')
expect(actions?.lastElementChild?.previousElementSibling).toHaveClass('reorder-buttons')
})
it('FE-PLANNER-DAYPLAN-064e: the keyboard reaches the note and opens it with Enter', () => {
@@ -2521,10 +2521,10 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
)}
</div>
{canEditDays && <div className="dp-note-actions flex flex-none items-center">
<div className="reorder-buttons" style={{ flexShrink: 0, display: 'flex', gap: 1, transition: 'opacity 0.15s' }}>
<button type="button" onClick={e => { e.stopPropagation(); void moveNote(day.id, note.id, 'up') }} disabled={noteIdx === 0} aria-label={t('dayplan.moveUp')} className="flex text-content-faint hover:text-content disabled:cursor-default disabled:text-edge"><ChevronUp size={12} strokeWidth={2} /></button>
<button type="button" onClick={e => { e.stopPropagation(); void moveNote(day.id, note.id, 'down') }} disabled={noteIdx === merged.length - 1} aria-label={t('dayplan.moveDown')} className="flex text-content-faint hover:text-content disabled:cursor-default disabled:text-edge"><ChevronDown size={12} strokeWidth={2} /></button>
</div>
<div className="reorder-buttons" style={{ flexShrink: 0, display: 'flex', gap: 1, transition: 'opacity 0.15s' }}>
<button type="button" onClick={e => { e.stopPropagation(); void moveNote(day.id, note.id, 'up') }} disabled={noteIdx === 0} aria-label={t('dayplan.moveUp')} className="flex text-content-faint hover:text-content disabled:cursor-default disabled:text-edge"><ChevronUp size={12} strokeWidth={2} /></button>
<button type="button" onClick={e => { e.stopPropagation(); void moveNote(day.id, note.id, 'down') }} disabled={noteIdx === merged.length - 1} aria-label={t('dayplan.moveDown')} className="flex text-content-faint hover:text-content disabled:cursor-default disabled:text-edge"><ChevronDown size={12} strokeWidth={2} /></button>
</div>
<MoreButton label={t('files.menu')} size={24} items={[
{ label: t('common.edit'), icon: Pencil, onClick: () => openEditNote(day.id, note) },
{ divider: true },
+4 -1
View File
@@ -703,7 +703,10 @@ describe('useAdmin', () => {
it('FE-ADMHOOK-036d: the open users tab asks again who is online, without the spinner', async () => {
const ticks: Array<() => void> = [];
const spy = vi.spyOn(window, 'setInterval').mockImplementation(((fn: () => void) => {
const realSetInterval = window.setInterval.bind(window);
// Only the hook's 30 s refresh is caught; waitFor keeps its own polling.
const spy = vi.spyOn(window, 'setInterval').mockImplementation(((fn: () => void, ms?: number) => {
if (ms !== 30_000) return realSetInterval(fn, ms);
ticks.push(fn);
return 0;
}) as unknown as typeof window.setInterval);