fix: preserve confirmed followup snapshots and expand flow checks

This commit is contained in:
2026-10-09 17:46:25 +08:00
parent 9185c6db04
commit e762a367da
7 changed files with 334 additions and 7 deletions
+19
View File
@@ -1423,3 +1423,22 @@ test('preview upload stops before create when readiness, upload permission or al
f.dispose()
}
})
test('dirty draft is replaced by the authoritative applied result from another operator', async () => {
let stored = task()
const copy = value => JSON.parse(JSON.stringify(value))
const f = setupPanel({ followupAudioLists: async () => ({ items: [copy(stored)] }), followupAudioDetail: async () => copy(stored) })
await settle(); await f.panel.openTask(1)
f.panel.reviewItems.value[0].values.fasting_blood_sugar = 9.9
stored = task(1, { status: 'applied', version: 2, items: [item({ values: { fasting_blood_sugar: 6.5 }, selected: true, needs_review: false })] })
await f.panel.refresh(); await settle()
assert.equal(f.panel.detail.value.status, 'applied')
assert.equal(f.panel.reviewItems.value[0].values.fasting_blood_sugar, 6.5)
assert.equal(f.panel.reviewItems.value[0].selected, true)
assert.equal(f.panel.reviewItems.value[0].needs_review, false)
assert.equal(f.panel.dirty.value, false)
assert.match(f.panel.errorMessage.value, /未保存.*未写入/)
assert.deepEqual(f.events, [['applied', 10]])
f.dispose()
})