Neuer Block-Atom task_overview (Markdown-Fence dorfteich-tasks, HTML-Placeholder). Shared extractTaskRows liest Task-Zeilen mit Text, Mentions (#150) und Start-/Zieldaten (#152); TasksService sammelt zur Lesezeit den Teilbaum (rekursiv via collectSubtreeIds, canAccessPage- Filter je Quellseite) aus Basis-State + page_updates-Log — KEINE abgeleitete Tabelle nötig (Teilbäume sind klein, kein Drift). Neuer auth-Endpoint GET /read/:pond/:slug/tasks; die öffentliche Ansicht expandiert den Placeholder serverseitig zur statischen Tabelle (Instanz-Sprache). NodeView mit Live-Tabelle und Rückschreib-Checkboxen (optimistisch, Override bis der debounced Collab-Persist nachzieht); Einfügen über die Block-Auswahl (eingebauter Eintrag). Unit- + DB-Tests, neuer CI-Pack tasks.spec (voller Loop inkl. Rückschreiben end-to-end), User-Guide-Doku en+de. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0155v2aT8AG1kZDQEZiCLBWC
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { extractTaskRows } from './tasks';
|
|
import { docToHtml } from './html';
|
|
import { docToMarkdown, markdownToDoc } from './markdown';
|
|
|
|
describe('task overview block + task extraction (issue #154)', () => {
|
|
it('round-trips the marker fence', () => {
|
|
const doc = markdownToDoc('Intro\n\n```dorfteich-tasks\n```\n\nOutro');
|
|
let found = 0;
|
|
doc.descendants((node) => {
|
|
if (node.type.name === 'task_overview') found += 1;
|
|
});
|
|
expect(found).toBe(1);
|
|
expect(docToMarkdown(doc)).toContain('```dorfteich-tasks');
|
|
});
|
|
|
|
it('renders the placeholder div for the permission-aware expansion', () => {
|
|
const html = docToHtml(markdownToDoc('```dorfteich-tasks\n```'));
|
|
expect(html).toContain('class="dt-task-overview" data-task-overview="1"');
|
|
});
|
|
|
|
it('extracts rows with text, mentions, and dates from task lists', () => {
|
|
const doc = markdownToDoc(
|
|
'- [ ] Bühne buchen @nadia >>2026-08-01\n- [x] Kabel prüfen <<2026-07-01\n\nKein Task.',
|
|
);
|
|
const rows = extractTaskRows(doc);
|
|
expect(rows).toHaveLength(2);
|
|
expect(rows[0]).toMatchObject({
|
|
checked: false,
|
|
text: 'Bühne buchen',
|
|
dueDate: '2026-08-01',
|
|
startDate: null,
|
|
});
|
|
expect(rows[0]!.mentions).toEqual([{ userId: '', username: 'nadia' }]);
|
|
expect(rows[1]).toMatchObject({
|
|
checked: true,
|
|
text: 'Kabel prüfen',
|
|
startDate: '2026-07-01',
|
|
dueDate: null,
|
|
});
|
|
// Markdown-born rows have no stable id yet (assigned in the editor, #153).
|
|
expect(rows[0]!.id).toBeNull();
|
|
});
|
|
});
|