fix(recording-tip): show "inserted" only after the text was actually inserted
The tip drew its done state on session-completed, before the async insert ran and even when auto-insert was off or the text was empty. A failed insert also left the screen-saver-level tip over the result popup's copy button. session-completed now says whether an insert follows, VoiceModeService emits text-inserted on success, and the tip hides first when the insert fails.
This commit is contained in:
parent
06365651fc
commit
e7937c877f
5 changed files with 104 additions and 12 deletions
|
|
@ -353,6 +353,21 @@ describe('표시 이벤트', () => {
|
|||
expect(phases).toEqual(['recording', 'thinking'])
|
||||
})
|
||||
|
||||
it('자동 삽입이 끝나면 text-inserted 를 내보낸다(완료 이벤트는 willInsert 로 예고한다)', async () => {
|
||||
const svc = getVoiceModeService()
|
||||
const inserted: string[] = []
|
||||
const willInsert: boolean[] = []
|
||||
svc.on('session-completed', (p) => willInsert.push(p.willInsert))
|
||||
svc.on('text-inserted', ({ sessionId }) => inserted.push(sessionId))
|
||||
|
||||
await svc.startSession('dictation')
|
||||
audioBus.emit('audio-data', { buffer: SPEECH })
|
||||
advanceClock(1000)
|
||||
await svc.stopSession()
|
||||
await vi.waitFor(() => expect(inserted).toHaveLength(1))
|
||||
expect(willInsert).toEqual([true])
|
||||
})
|
||||
|
||||
it('자동 삽입이 실패하면 insert-failed 를 내보낸다', async () => {
|
||||
mockInsert.insertText.mockRejectedValueOnce(new Error('clipboard busy'))
|
||||
const svc = getVoiceModeService()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue