feat(tasks): add keyboard index and productivity dashboard improvements
This commit is contained in:
1 parent
02edb51b8a
commit
667776e43f
44 files changed
+1224
-138
No files matched your search
+23
-1
@@ -8,7 +8,8 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
const prefs=await fetch(api+'preferences').then(r=>r.json());const saved=await fetch(api+'preferences',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify({...prefs.preferences,notify_due:true,notify_planned:true,reminder_time:'10:35'})});if(!saved.ok)throw Error('Preferences save failed');
|
||||
document.querySelector('#tasks-new').click();await wait(()=>input('page_path'));
|
||||
if(input('notify_due').checked||input('notify_planned').checked)throw Error('Undated task enabled reminders');
|
||||
fill(input('title'),'タスク編集のレイアウト確認');fill(input('notes'),'主要項目を左右に整理。日付と通知をまとめて設定します。');
|
||||
fill(input('title'),'**タスク編集のレイアウト確認**');fill(input('notes'),'主要項目を左右に整理。日付と通知をまとめて設定します。');
|
||||
fill(input('references'),'https://example.test/doc\n/files/資料.pdf');
|
||||
fill(input('planned_on'),'2030-01-01');fill(input('due_on'),'2030-01-02');
|
||||
if(!input('notify_due').checked||!input('notify_planned').checked||input('reminder_time').value!=='10:35')throw Error('Dated defaults missing');
|
||||
input('notify_due').click();fill(input('due_on'),'2030-01-03');if(input('notify_due').checked)throw Error('Explicit reminder choice overwritten');
|
||||
@@ -18,6 +19,9 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
if(task.status!=='doing'||task.bucket!=='backlog'||task.complexity!==4||!task.notify_planned||task.notify_due||task.reminder_time!=='10:35')throw Error('Editor fields not persisted');
|
||||
await wait(()=>document.querySelector('[data-task-id="'+task.uuid+'"] [data-action=detail]'));document.querySelector('[data-task-id="'+task.uuid+'"] [data-action=detail]').click();await wait(()=>input('page_path'));
|
||||
if(input('notify_due').checked)throw Error('Defaults changed existing task');
|
||||
if(task.references?.length!==2||input('references').value!=='https://example.test/doc\n/files/資料.pdf')throw Error('Task references lost');
|
||||
const preview=document.querySelector('.task-title-preview');if(!preview?.querySelector('strong')||getComputedStyle(preview).display==='none'||preview.getBoundingClientRect().height<10)throw Error('Markdown title preview missing');
|
||||
const safe=document.createElement('div');PagesTaskPresentation.render(safe,'<img src=x onerror=alert(1)> [bad](javascript:alert) **safe**');if(safe.querySelector('img,a')||!safe.querySelector('strong'))throw Error('Unsafe task Markdown');
|
||||
if(form.querySelector('.task-editor-advanced').open)throw Error('Advanced section should start collapsed');
|
||||
const fields=document.querySelector('#tasks-fields'),rect=dialog.getBoundingClientRect();
|
||||
if(rect.width>innerWidth+1||rect.height>innerHeight+1||fields.scrollWidth>fields.clientWidth+1)throw Error('Editor overflow');
|
||||
@@ -46,6 +50,24 @@ window.addEventListener('load',async()=>{const wait=async(fn)=>{for(let i=0;i<12
|
||||
document.querySelector('#dashboard-controls button[aria-pressed]').click();const width=document.querySelector('[data-widget=tasks] [data-size=width]');width.value='6';width.dispatchEvent(new Event('change'));const height=document.querySelector('[data-widget=tasks] [data-size=height]');height.value='5';height.dispatchEvent(new Event('change'));
|
||||
document.querySelector('[data-widget=tasks] .widget-arrange button').click();document.querySelector('#dashboard-controls button:last-child').click();await wait(()=>document.querySelector('#dashboard-status').textContent.includes('保存しました'));const layout=await fetch('/_/api/v1/extension/organizer.tasks/dashboard').then(r=>r.json());if(layout.widgets[2].id!=='tasks'||layout.widgets[2].width!==6||layout.widgets[2].height!==5||layout.widgets[2].tab!=='done')throw Error('Layout did not persist');
|
||||
if(!document.querySelector('.organizer-nav a[href="/v/plan/contacts"]')||!document.querySelector('.organizer-nav a[aria-current="page"]'))throw Error('Shared navigation missing');
|
||||
const add=document.querySelector('#dashboard-controls select');
|
||||
for(const id of ['commands','tomorrow-schedule']){add.value=id;add.dispatchEvent(new Event('change'));}
|
||||
await wait(()=>document.querySelector('.dashboard-command'));
|
||||
const command=document.querySelector('.dashboard-command'),commandInput=command.querySelector('input'),api='/_/api/v1/extension/organizer.tasks/';
|
||||
const run=async text=>{fill(commandInput,text);command.requestSubmit();await wait(()=>!command.querySelector('button').disabled);if(commandInput.value)throw Error('Command failed: '+command.parentElement.textContent);};
|
||||
await run('add task **Command fixture**');
|
||||
let items=await fetch(api+'items?q=Command%20fixture').then(r=>r.json());const id=items.items[0].uuid;
|
||||
fill(commandInput,'today Command');await wait(()=>document.querySelector('#dashboard-command-tasks option'));if(!document.querySelector('#dashboard-command-tasks option').value.includes(id))throw Error('Command task suggestions missing');
|
||||
await run('today '+id);let item=await fetch(api+'items/'+id).then(r=>r.json());if(item.item.planned_on!==document.querySelector('#organizer-dashboard').dataset.today)throw Error('Today command failed');
|
||||
await run('tomorrow '+id);await run('due '+id+' 2030-12-31');item=await fetch(api+'items/'+id).then(r=>r.json());if(item.item.due_on!=='2030-12-31')throw Error('Due command failed');
|
||||
await wait(()=>document.querySelector('[data-widget=tomorrow] strong'));
|
||||
window.confirm=()=>false;fill(commandInput,'delete '+id);command.requestSubmit();await wait(()=>!command.querySelector('button').disabled);if(!(await fetch(api+'items/'+id)).ok)throw Error('Unconfirmed deletion');
|
||||
window.confirm=()=>true;await run('delete '+id);if((await fetch(api+'items/'+id)).status!==404)throw Error('Deletion failed');
|
||||
const date=new Date(document.querySelector('#organizer-dashboard').dataset.today+'T12:00:00Z');date.setUTCDate(date.getUTCDate()+1);const day=date.toISOString().slice(0,10),calAPI='/_/api/v1/extension/organizer.calendar/';
|
||||
const calendars=await fetch(calAPI+'calendars').then(r=>r.json());const calendar=(calendars.calendars||calendars.items)[0];
|
||||
const response=await fetch(calAPI+'calendars/'+calendar.id+'/events',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({summary:'Tomorrow visual fixture',start:day+'T03:00:00Z',end:day+'T04:00:00Z'})});if(!response.ok)throw Error('Event fixture failed');
|
||||
document.querySelector('#dashboard-controls button').click();await wait(()=>document.querySelector('[data-widget=tomorrow-schedule] .agenda-event'));
|
||||
if(!document.querySelector('[data-widget=tomorrow-schedule]').textContent.includes('Tomorrow visual fixture'))throw Error('Tomorrow schedule missing');
|
||||
}else if(path==='/v/plan/tasks'){
|
||||
const prefs=await fetch('/_/api/v1/extension/organizer.tasks/preferences').then(r=>r.json());await fetch('/_/api/v1/extension/organizer.tasks/preferences',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify({...prefs.preferences,due_days:2,estimate_minutes:60})});
|
||||
await wait(()=>document.querySelector('#tasks-quick-title'));fill(document.querySelector('#tasks-quick-title'),'Recording task');document.querySelector('#tasks-capture').requestSubmit();await wait(()=>document.querySelector('[data-action=work]'));document.querySelector('[data-action=work]').click();await wait(()=>document.querySelector('.task-work-bar a').textContent.includes('Recording task'));document.querySelector('.task-work-bar button').click();await wait(()=>document.querySelector('.task-work-bar').hidden);
|
||||
|
||||
Reference in new issue
Block a user