App quality: offline badge, per-note history, keyboard study mode, notes import
- Study cards say whether the Bible text works offline, with a button to save the missing book (notes are always kept on the device). - Each note keeps its last 12 versions with Restore (History under each note). - Keyboard-only study: 1/2/3 write in Observe/Interpret/Apply, C/W/X/P switch resource tabs, V compares, Esc leaves a note box; listed under "?". - Export > Import notes: bring Word/Markdown/text notes into the matching chunks without overwriting anything; can mark them as not your own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
648c3206df
commit
67645cf1df
14 files changed
+421
-7
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { beforeEach, expect, test } from 'vitest';
|
||||
import { MAX_VERSIONS, listNoteVersions, recordNoteVersion } from './noteHistory.js';
|
||||
|
||||
beforeEach(() => localStorage.clear());
|
||||
|
||||
test('versions are kept newest first, and blanks and repeats are skipped', () => {
|
||||
recordNoteVersion('c1', 'observation', 'first', 1);
|
||||
recordNoteVersion('c1', 'observation', 'first', 2); // same as the newest
|
||||
recordNoteVersion('c1', 'observation', ' ', 3); // blank
|
||||
recordNoteVersion('c1', 'observation', 'second', 4);
|
||||
expect(listNoteVersions('c1', 'observation').map((v) => v.text)).toEqual(['second', 'first']);
|
||||
expect(listNoteVersions('c1', 'application')).toEqual([]);
|
||||
expect(listNoteVersions('c2', 'observation')).toEqual([]);
|
||||
});
|
||||
|
||||
test('only the latest versions are kept', () => {
|
||||
for (let i = 0; i < MAX_VERSIONS + 5; i += 1) recordNoteVersion('c1', 'observation', `v${i}`, i);
|
||||
const list = listNoteVersions('c1', 'observation');
|
||||
expect(list).toHaveLength(MAX_VERSIONS);
|
||||
expect(list[0].text).toBe(`v${MAX_VERSIONS + 4}`);
|
||||
});
|
||||
|
||||
test('a damaged store reads as empty', () => {
|
||||
localStorage.setItem('note-history:c1:observation', '{nope');
|
||||
expect(listNoteVersions('c1', 'observation')).toEqual([]);
|
||||
});
|
||||
Reference in new issue
Block a user