feat: plan Following changes and continue review (Closes #1326)
This commit is contained in:
1 parent
0f36d3077b
commit
07836f7176
6 files changed
+107
-7
No files matched your search
@@ -487,6 +487,40 @@ def test_following_review_controls_are_wired_into_the_phone_preview_flow():
|
||||
assert "afterUnwatch:item => followingQueue.retire(item)" in dashboard
|
||||
assert "followingQueue.returnToFollowing()" in dashboard
|
||||
assert "'Back to Following'" in dashboard
|
||||
|
||||
|
||||
def test_following_open_issue_exposes_only_action_and_continue_planning_dispositions():
|
||||
script = f"""
|
||||
const createFollowing = require({json.dumps(str(MODULE))});
|
||||
const disposition = createFollowing.planningDisposition;
|
||||
process.stdout.write(JSON.stringify({{
|
||||
active:disposition({{following:true,kind:'issue',state:'open',claimable:true}}),
|
||||
generic:disposition({{following:false,kind:'issue',state:'open',claimable:true}}),
|
||||
pull:disposition({{following:true,kind:'pull',state:'open',assigned_to_me:true}}),
|
||||
}}));
|
||||
"""
|
||||
result = json.loads(subprocess.run(
|
||||
["node", "-e", script], text=True, capture_output=True, check=True
|
||||
).stdout)
|
||||
|
||||
assert result == {
|
||||
"active": {
|
||||
"active": True,
|
||||
"today": "Add to Today & next",
|
||||
"later": "Later & next",
|
||||
"week": "Week Ahead & next",
|
||||
},
|
||||
"generic": {"active": False},
|
||||
"pull": {"active": False},
|
||||
}
|
||||
|
||||
dashboard = (ROOT / "frontend" / "dashboard.js").read_text()
|
||||
css = (ROOT / "frontend" / "dashboard.css").read_text()
|
||||
service_worker = (ROOT / "frontend" / "service-worker.js").read_text()
|
||||
assert "followingQueue.preview(state);" in dashboard
|
||||
assert "following-disposition-mode" in MODULE.read_text()
|
||||
assert "controls.claim.hidden = controls.start.hidden = controls.watch.hidden = true" in MODULE.read_text()
|
||||
assert ".following-disposition-mode" in css
|
||||
assert "if (searchPreviewReturnKind === 'following')" in dashboard
|
||||
assert "e.key === 'Escape' && searchPreviewReturnKind === 'following'" in dashboard
|
||||
assert "stackchain-dashboard-shell-v137" in service_worker
|
||||
|
||||
@@ -98,7 +98,12 @@ const outcome=await planner.plan({kind:'issue',state:'open',assigned_to_me:true}
|
||||
console.log(JSON.stringify(outcome));
|
||||
""")
|
||||
|
||||
assert result == {"status": "planned-pending", "date": "2026-08-22", "estimate": 45}
|
||||
assert result == {
|
||||
"status": "planned-pending",
|
||||
"date": "2026-08-22",
|
||||
"estimate": 45,
|
||||
"item": {"kind": "issue", "state": "open", "assigned_to_me": True},
|
||||
}
|
||||
|
||||
|
||||
def test_search_week_plan_stages_canonical_details_before_flushing():
|
||||
@@ -122,3 +127,37 @@ console.log(JSON.stringify({outcome,calls}));
|
||||
["details", "issue:stackchain/dashboard:42:", "Canonical title", "stackchain/dashboard", 42],
|
||||
["flush"],
|
||||
]
|
||||
|
||||
|
||||
def test_search_week_plan_waits_for_success_callback_before_closing():
|
||||
result = run_planner("""
|
||||
const events=[];
|
||||
const nodes={};
|
||||
function node(extra={}) { return Object.assign({
|
||||
hidden:true,disabled:false,textContent:'',value:'',dataset:{},
|
||||
addEventListener(){},focus(){events.push('focus');},
|
||||
setAttribute(){},querySelectorAll(){return[];}
|
||||
},extra); }
|
||||
nodes['#search-week-plan-sheet']=node();
|
||||
nodes['#search-week-plan-status']=node();
|
||||
nodes['#confirm-search-week-plan']=node();
|
||||
nodes['#search-week-plan-copy']=node();
|
||||
nodes['#search-week-plan-days']=node({dataset:{selected:'2026-08-22'}});
|
||||
nodes['#search-week-plan-estimate']=node({value:'45'});
|
||||
nodes['#plan-search-result']=node(); nodes['#cancel-search-week-plan']=node();
|
||||
const document={querySelector:selector=>nodes[selector],addEventListener(){}};
|
||||
const window={history:{state:{},pushState(value){this.state=value;},back(){events.push('back');nodes['#search-week-plan-sheet'].hidden=true;}},location:{href:'/'},addEventListener(){}};
|
||||
const planner={pending:()=>false,preview:async()=>({days:[{date:'2026-08-22',label:'Sat',planned_minutes:0,capacity_minutes:90,ids:[]}]}),
|
||||
plan:async()=>({status:'planned',date:'2026-08-22',estimate:45,item:{number:42}})};
|
||||
const ui=createSearchWeekPlan.UI({planner,document,window,getDetail:()=>({title:'Issue',number:42}),
|
||||
escapeHtml:value=>value,escapeAttribute:value=>value,announce:message=>events.push(message),
|
||||
onPlanned:async()=>{events.push('callback-start');await Promise.resolve();events.push('callback-end');}});
|
||||
await ui.open(node());
|
||||
await ui.confirm();
|
||||
events.push(nodes['#search-week-plan-sheet'].hidden?'closed':'open');
|
||||
console.log(JSON.stringify({events}));
|
||||
""")
|
||||
|
||||
assert result["events"][-4:] == [
|
||||
"callback-start", "callback-end", "back", "closed"
|
||||
]
|
||||
Reference in new issue
Block a user