diff --git a/PlotLine.Tests/Browser/focus-synchronisation.cjs b/PlotLine.Tests/Browser/focus-synchronisation.cjs index 45256f0c..889b7861 100644 --- a/PlotLine.Tests/Browser/focus-synchronisation.cjs +++ b/PlotLine.Tests/Browser/focus-synchronisation.cjs @@ -26,7 +26,7 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; await p.locator('[data-focus-toggle]').click();await p.locator('[data-focus-position]').selectOption('22/32');await p.waitForURL(/Chapters\/Details\/22/);await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus?.state.sceneID===32);assert.equal(await p.locator('[data-focus-chapter]').getAttribute('data-chapter'),'22'); await command('previous');await p.waitForURL(/Chapters\/Details\/21/);await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus?.state.sceneID===101);assert.equal(await p.locator('[data-pd-context=scene][aria-current=location]').getAttribute('data-pd-context-id'),'101'); const form=p.locator('[data-focus-chapter] form:has(input[name=overwriteAuthor])');await form.locator('input[type=checkbox]').check();await set({chapterID:22,sceneID:32});assert.equal(await p.locator('[data-focus-chapter]').getAttribute('data-chapter'),'21');await go();assert.match(await p.locator('[data-focus-workspace-status]').textContent(),/Save or cancel/);await form.evaluate(n=>n.reset());await go();await p.waitForURL(/Chapters\/Details\/22/);await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus?.state.sceneID===32); - const version=(await state()).version;await go();assert.equal((await state()).version,version,'aligned Chapter Go retains scene and version'); + const version=(await state()).version;await go();assert.equal((await state()).version,version,'aligned Chapter Go retains scene and version');assert.equal(await p.locator('[data-focus-workspace-status]').count(),0,'aligned chapter has no status strip or empty wrapper'); await p.goto(base+'/Writer/Review?projectId=7&bookId=12');await positioned(32);let baseline=await position();assert(baseline.id,'initial Review load positions verified scene');await clear();await go();await positioned(32);assert.deepEqual(await position(),baseline,'initial load and Go use identical accepted target and offset'); for(const scene of [31,101,32]){const chapter=scene===32?22:21;await choose(chapter+'/'+scene);baseline=await position();assert.equal((await p.evaluate(()=>window.__focusEvents.length)),1,'one authoritative event per successful selection');assert.equal(baseline.id,await p.locator(`[data-paragraph-id][data-scene-id="${scene}"]`).first().getAttribute('data-paragraph-id'));await clear();await go();await positioned(scene);assert.deepEqual(await position(),baseline,'Go leaves identical scene position unchanged');} // Return to the same scene through canonical ribbon stepping and recent history. @@ -45,6 +45,15 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; if(installed){const divider=await p.locator(active+' .pd-ribbon-focus').evaluate(n=>{const s=getComputedStyle(n);return {width:s.borderRightWidth,style:s.borderRightStyle,color:s.borderRightColor};});assert.equal(divider.width,'1px');assert.equal(divider.style,'solid');} await p.route('**/StoryPoint?*',r=>r.fulfill({status:503,body:'Synthetic unavailable snapshot'}));await p.route('**/StoryPoint/Index?*',r=>r.fulfill({status:503,body:'Synthetic unavailable snapshot'}));await go();assert.match(await p.locator('[data-focus-workspace-status]').textContent(),/could not be loaded/); await p.goto(base+'/fixture?desktop=Characters');await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus);assert(await p.locator(active+' [data-global-focus=go]').isDisabled());assert.match(await p.locator(active+' [data-global-focus=go]').getAttribute('title'),/does not support/); + // Success locations belong in the header, not duplicate page-level status strips. + for(const path of ['/Chapters/Details/21','/Writer/Chapter/21','/fixture?record=Chapters','/Scenes/Edit/31','/Writer/Index?projectId=7&bookId=12','/Writer/Write?projectId=7&bookId=12&objective=true','/fixture?desktop=Books','/fixture?desktop=StoryPoint','/fixture?record=Characters','/fixture?page=maps']){ + await p.goto(base+path);await p.waitForFunction(()=>window.PlotDirectorNarrativeFocus); + assert.equal(await p.locator('[data-focus-workspace-status]').count(),0,path+' has no redundant strip'); + assert.doesNotMatch(await p.locator('main').first().innerText(),/Displaying current focus|Current narrative location:|Current Focus:/i,path); + assert.equal(await p.locator('[data-writer-global-location]').count(),0); + assert(await p.locator('[data-focus-label]').count());assert(await p.locator('[data-narrative-status][role=status]').count(),'header accessibility status retained'); + if(path==='/Chapters/Details/21')for(const width of [1666,950]){await p.setViewportSize({width,height:1050});await p.screenshot({path:`/tmp/pd-focus-text-${installed?'pwa':'browser'}-${width}.png`});} + } console.log(`PASS ${installed?'installed Chromium PWA':'Chromium'} focus synchronisation: stable-ID chapter follow/dirty guard/Go, identical initial/header/recent/ribbon/Go/refresh accepted positions, canonical boundaries, stale anchor/response rejection, missing-map fallback, repeatable sticky/narrow offsets, disabled explanations and Focus/Help divider.`); }finally{await c.close();await b?.close();fs.rmSync(profile,{recursive:true,force:true});} })().catch(e=>{console.error(e.stack);process.exitCode=1;}); diff --git a/PlotLine/Views/Writer/Index.cshtml b/PlotLine/Views/Writer/Index.cshtml index 63983728..966b1ed8 100644 --- a/PlotLine/Views/Writer/Index.cshtml +++ b/PlotLine/Views/Writer/Index.cshtml @@ -3,7 +3,6 @@ ViewData["Title"] = "Writer Home"; ViewData["ProjectSection"] = "Writer"; ViewData["ShellClass"] = "pd-writer writer3-shell"; - var focus = Model.NarrativeFocus?.Label; }
Work on your chapters, scenes
and manuscript.
Saved Writer objective
-Current narrative location: @(Model.NarrativeFocus?.Label ?? "Choose in Current Focus")
Objective target: @(focus?.SceneTitle ?? focus?.ChapterTitle ?? "Across the book"). This target changes only when you edit the objective.