feat(workspace): bar above the phone keyboard to indent, outdent and move bullets
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m33s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-10-31 11:09:39 +01:00
1 parent 32b79b5d62
commit c6a2cfb85c
9 files changed
+183 -7

No files matched your search

+31 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { listLabel, numberedLabels } from '../outlineList';
import { listLabel, moveSibling, numberedLabels } from '../outlineList';
import type { DocumentBlock } from '../types';
const blk = (id: string, level: number, type: DocumentBlock['type'] = 'numbered'): DocumentBlock => ({
@@ -25,3 +25,33 @@ describe('numbered lists', () => {
});
});
});
describe('moveSibling (phone bar ↑ ↓)', () => {
// A
// a1
// a2
// a2x
// B
// b1
// C
const tree = [blk('A', 0), blk('a1', 1), blk('a2', 1), blk('a2x', 2), blk('B', 0), blk('b1', 1), blk('C', 0)];
const ids = (bs: DocumentBlock[]) => bs.map((b) => b.id).join(' ');
it('swaps with the previous sibling and takes the children along', () => {
expect(ids(moveSibling(tree, 'B', -1))).toBe('B b1 A a1 a2 a2x C');
expect(ids(moveSibling(tree, 'a2', -1))).toBe('A a2 a2x a1 B b1 C');
});
it('swaps with the next sibling, jumping over its whole branch', () => {
expect(ids(moveSibling(tree, 'A', 1))).toBe('B b1 A a1 a2 a2x C');
expect(ids(moveSibling(tree, 'a1', 1))).toBe('A a2 a2x a1 B b1 C');
});
it('never leaves its parent and stops at the ends', () => {
expect(moveSibling(tree, 'a1', -1)).toBe(tree); // first child
expect(moveSibling(tree, 'a2', 1)).toBe(tree); // last child
expect(moveSibling(tree, 'A', -1)).toBe(tree);
expect(moveSibling(tree, 'C', 1)).toBe(tree);
expect(moveSibling(tree, 'missing', 1)).toBe(tree);
});
});