Files
MindSift/frontend/src/lib/__tests__/wikiLink.test.ts
T
sandrodachandClaude Opus 5.5 68bc4d279c
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m20s
fix(workspace): hidden bullet actions on phones, no second extract, notice layout
- The floating bullet actions only react to hover on devices with a real
  pointer; a tap on a phone made the invisible buttons clickable.
- A bullet that is only a note link (plus hashtags) can no longer be
  extracted: button and /extract are hidden, the server answers 400.
- Extract notice on phones sits above the bottom navigation, text on
  top (two lines max) with the actions below.
- Release v0.26.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 19:56:32 +01:00

30 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, it, expect } from 'vitest';
import { buildBlockLink, isNoteLinkOnly, parseWikiLink, wikiLinkText } from '../wikiLink';
describe('wiki links', () => {
it('parses plain, labelled, section and bullet links', () => {
expect(parseWikiLink('Homelab')).toEqual({ title: 'Homelab', blockId: undefined, label: undefined });
expect(parseWikiLink('Homelab|hier')).toEqual({ title: 'Homelab', blockId: undefined, label: 'hier' });
expect(parseWikiLink('Homelab#Abschnitt')).toEqual({ title: 'Homelab', blockId: undefined, label: undefined });
expect(parseWikiLink('Homelab#^blk_a_1|Homelab › Backup')).toEqual({
title: 'Homelab', blockId: 'blk_a_1', label: 'Homelab › Backup',
});
});
it('builds a bullet link that parses back', () => {
const link = buildBlockLink('Homelab [neu]', 'blk_x', 'Backups liefen bisher nur manuell – das soll sich ändern #backup');
expect(link).toBe('[[Homelab neu#^blk_x|Homelab neu › Backups liefen bisher nur manuell – das…]]');
const parsed = parseWikiLink(link.slice(2, -2));
expect(parsed.blockId).toBe('blk_x');
expect(wikiLinkText(parsed)).toBe('Homelab neu › Backups liefen bisher nur manuell – das…');
});
it('recognises a bullet that is only a link to a note', () => {
expect(isNoteLinkOnly('[[Konzept: Garten]]')).toBe(true);
expect(isNoteLinkOnly('[[Konzept: Garten]] #draußen #idee')).toBe(true);
expect(isNoteLinkOnly('Siehe [[Konzept: Garten]]')).toBe(false);
expect(isNoteLinkOnly('[[Konzept: Garten]] und mehr')).toBe(false);
expect(isNoteLinkOnly('Garten')).toBe(false);
});
});