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:
Yun Chan 2026-10-21 11:35:14 +09:00
parent 06365651fc
commit e7937c877f
5 changed files with 104 additions and 12 deletions

View file

@ -93,11 +93,13 @@ describe('RecordingTipPresenter', () => {
expect(view.calls).toEqual(['error:x'])
})
it('완료는 "입력함"을 잠깐 보이고 숨기며, 곧바로 시작한 새 세션의 팁은 숨기지 않는다', () => {
it('입력에 성공하면 "입력함"을 잠깐 보이고 숨기며, 곧바로 시작한 새 세션의 팁은 숨기지 않는다', () => {
const view = fakeView()
const presenter = new RecordingTipPresenter(view)
presenter.onPhase('recording')
presenter.onSessionCompleted()
presenter.onSessionCompleted(true)
expect(view.calls).toEqual(['show'])
presenter.onTextInserted()
vi.advanceTimersByTime(699)
expect(view.calls).toEqual(['show', 'done'])
vi.advanceTimersByTime(1)
@ -105,11 +107,41 @@ describe('RecordingTipPresenter', () => {
const view2 = fakeView()
const presenter2 = new RecordingTipPresenter(view2)
presenter2.onSessionCompleted()
presenter2.onSessionCompleted(true)
presenter2.onTextInserted()
vi.advanceTimersByTime(300)
presenter2.onSessionStarted()
presenter2.onPhase('recording')
vi.advanceTimersByTime(2000)
expect(view2.calls).toEqual(['done', 'show'])
})
it('자동 입력을 하지 않는 완료는 "입력함" 없이 숨긴다', () => {
const view = fakeView()
const presenter = new RecordingTipPresenter(view)
presenter.onPhase('recording')
presenter.onSessionCompleted(false)
presenter.onTextInserted()
expect(view.calls).toEqual(['show', 'hide'])
})
it('입력이 실패하면 "입력함" 없이 팁을 내리고 결과 팝업을 띄운다', () => {
const view = fakeView()
const presenter = new RecordingTipPresenter(view)
presenter.onPhase('recording')
presenter.onSessionCompleted(true)
presenter.onInsertFailed('text')
vi.advanceTimersByTime(10000)
expect(view.calls).toEqual(['show', 'hide', 'result:text:10000'])
})
it('입력 결과가 오지 않으면 잠시 뒤 숨기고, 늦게 온 성공은 무시한다', () => {
const view = fakeView()
const presenter = new RecordingTipPresenter(view)
presenter.onPhase('recording')
presenter.onSessionCompleted(true)
vi.advanceTimersByTime(5000)
presenter.onTextInserted()
expect(view.calls).toEqual(['show', 'hide'])
})
})