Stage 5: live Markdown editor (source+preview), autosave, word count, find bar, save-state indicator
This commit is contained in:
parent
4b8d78458c
commit
25baae2950
9 changed files with 390 additions and 6 deletions
|
|
@ -38,6 +38,7 @@ const {
|
|||
deleteChapter,
|
||||
duplicateChapter,
|
||||
reorderChapters,
|
||||
setChapterContent,
|
||||
moveInOrder,
|
||||
} = chapters;
|
||||
|
||||
|
|
@ -83,6 +84,13 @@ ok(dup.id !== c1.id, "duplicate has new id");
|
|||
ok(getChapterContent(dir, dup.id) === "Hello world this is text", "duplicate copies content");
|
||||
ok(loadBook(dir).chapterOrder.slice(-1)[0] === dup.id, "duplicate appended to order");
|
||||
|
||||
// setChapterContent writes markdown to disk by chapter id
|
||||
setChapterContent(dir, c1.id, "# Introduction\n\nWelcome.");
|
||||
ok(getChapterContent(dir, c1.id) === "# Introduction\n\nWelcome.", "setChapterContent persists markdown");
|
||||
let threw2 = false;
|
||||
try { setChapterContent(dir, "nope", "x"); } catch { threw2 = true; }
|
||||
ok(threw2, "setChapterContent throws on unknown id");
|
||||
|
||||
// delete
|
||||
const c3File = path.join(dir, c3.file);
|
||||
deleteChapter(dir, c3.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue