Add fullscreen rich journals, inline recording and reference-based cloud cleanup
This commit is contained in:
+9
-9
@@ -12,11 +12,11 @@ test('browser hashes in 4 MiB slices rather than loading the entire video',async
|
||||
});
|
||||
test('journals default to private and encode content before rendering',()=>{
|
||||
const html=require('./test-support/ui-source')(),js=fs.readFileSync('web/journal.js','utf8');
|
||||
assert.match(html,/<select name="visibility"><option value="private">/);assert.match(js,/esc\(e.text\)/);assert.match(js,/esc\(c.text\)/);
|
||||
assert.match(html,/<select name="visibility"><option value="private">/);assert.match(js,/ZhaoJournalEditor.render\(entry/);assert.match(js,/esc\(c.text\)/);
|
||||
assert.doesNotMatch(js,/localStorage|indexedDB|caches\.open|access_token|secretKey.*localStorage/);
|
||||
});
|
||||
test('leave clears media URLs, live microphone tracks, and pending requests',()=>{
|
||||
const js=fs.readFileSync('web/journal.js','utf8');assert.match(js,/journalRequest\?\.abort\(\)/);assert.match(js,/releaseJournalMedia/);assert.match(js,/removeAttribute\('src'\)/);assert.match(js,/getTracks\(\).forEach\(t=>t.stop\(\)\)/);
|
||||
const js=fs.readFileSync('web/journal.js','utf8');assert.match(js,/journalQueue.clear\(\)/);assert.match(js,/abandon-draft/);assert.match(js,/releaseJournalMedia/);assert.match(js,/removeAttribute\('src'\)/);assert.match(js,/getTracks\(\).forEach\(t=>t.stop\(\)\)/);
|
||||
});
|
||||
test('photos load by default and audio/video preload metadata with controls, never autoplay',()=>{
|
||||
const vm=require('node:vm'),js=fs.readFileSync('web/journal.js','utf8');
|
||||
@@ -27,12 +27,12 @@ test('photos load by default and audio/video preload metadata with controls, nev
|
||||
if(mime.startsWith('image'))assert.match(html,/loading="lazy"/);else assert.match(html,/controls preload="metadata"/);
|
||||
}
|
||||
});
|
||||
test('successful save clears draft attachment ids, stops recorder, and reloads feed',()=>{
|
||||
test('successful save resets rich draft, stops recorder, exits fullscreen, and reloads feed',()=>{
|
||||
const js=fs.readFileSync('web/journal.js','utf8');
|
||||
const fn=js.slice(js.indexOf('function newJournal'),js.indexOf('async function loadJournal'));
|
||||
assert.match(fn,/journalDraftMedia.clear\(\)/);assert.match(fn,/journalSelectedMedia.clear\(\)/);assert.match(fn,/stopJournalVoice\(\)/);assert.match(fn,/journal-library'\).open=false/);
|
||||
assert.match(js,/newJournal\(\);resetJournalFilters\('mine'\);await loadJournal\(saved.id\)/);
|
||||
assert.match(js,/available.filter\(m=>journalDraftMedia.has\(m.id\)\)/);
|
||||
assert.match(fn,/abandonJournalDraft\(\)/);assert.match(fn,/clearJournalForm\(\)/);assert.match(fn,/stopJournalVoice\(\)/);
|
||||
assert.match(js,/newJournal\(\);collapseJournalEditor\(\);resetJournalFilters\('mine'\);await loadJournal\(saved.id\)/);
|
||||
assert.match(js,/content:window.ZhaoJournalEditor.document\(\)/);
|
||||
});
|
||||
test('attachment preview uses a closable dialog and deletion has a restore path',()=>{
|
||||
const js=fs.readFileSync('web/journal.js','utf8'),html=require('./test-support/ui-source')();
|
||||
@@ -47,11 +47,11 @@ test('structured place formatting and search preserve separate ancestral/birth/l
|
||||
});
|
||||
test('new entry clears hidden edit identifiers even when form.reset preserves them',()=>{
|
||||
const vm=require('node:vm'),js=fs.readFileSync('web/journal.js','utf8');
|
||||
const form={elements:{id:{value:'old-entry'},revision:{value:'9'},clientId:{value:'old-request'}},reset(){}};
|
||||
const context={$:()=>form};vm.createContext(context);
|
||||
const form={elements:{id:{value:'old-entry'},revision:{value:'9'},clientId:{value:'old-request'},draftId:{value:'old-draft'}},reset(){}};
|
||||
let reset=false;const context={$:()=>form,window:{ZhaoJournalEditor:{reset(){reset=true}}}};vm.createContext(context);
|
||||
vm.runInContext(js.match(/function clearJournalForm\(\)\{[^\n]+/)[0]+'\nclearJournalForm();',context);
|
||||
for(const field of Object.values(form.elements))assert.equal(field.value,'');
|
||||
assert.match(js,/function newJournal\(\)\{clearJournalForm\(\)/);
|
||||
assert.ok(reset);assert.match(js,/function newJournal\(\).*clearJournalForm\(\)/);
|
||||
assert.match(js,/function resetJournal\(\).*clearJournalForm\(\)/);
|
||||
});
|
||||
test('initial composer setup happens before asynchronous loading and never clears a typed draft',()=>{
|
||||
|
||||
Reference in New Issue
Block a user