mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-10 22:41:14 +00:00
Merge 2134c03893 into 7adbfec2a4
This commit is contained in:
commit
631d11982b
2 changed files with 104 additions and 0 deletions
|
|
@ -296,6 +296,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
setSecondaryButtonText(t("chat:startNewTask.title"))
|
||||
break
|
||||
case "followup":
|
||||
if (!isPartial) {
|
||||
playSound("notification")
|
||||
}
|
||||
setSendingDisabled(isPartial)
|
||||
setClineAsk("followup")
|
||||
// setting enable buttons to `false` would trigger a focus grab when
|
||||
|
|
|
|||
|
|
@ -515,6 +515,107 @@ describe("ChatView - Notification Sound with Queued Messages", () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe("ChatView - Followup Notification Sound", () => {
|
||||
beforeEach(() => vi.clearAllMocks())
|
||||
|
||||
it("plays notification sound when a non-partial followup ask is received", async () => {
|
||||
renderChatView()
|
||||
|
||||
// First hydrate state with initial task
|
||||
mockPostMessage({
|
||||
soundEnabled: true,
|
||||
messageQueue: [],
|
||||
clineMessages: [
|
||||
{
|
||||
type: "say",
|
||||
say: "task",
|
||||
ts: Date.now() - 2000,
|
||||
text: "Initial task",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// Clear any initial calls
|
||||
mockPlayFunction.mockClear()
|
||||
|
||||
// Add a followup ask message
|
||||
mockPostMessage({
|
||||
soundEnabled: true,
|
||||
messageQueue: [],
|
||||
clineMessages: [
|
||||
{
|
||||
type: "say",
|
||||
say: "task",
|
||||
ts: Date.now() - 2000,
|
||||
text: "Initial task",
|
||||
},
|
||||
{
|
||||
type: "ask",
|
||||
ask: "followup",
|
||||
ts: Date.now(),
|
||||
text: "Could you clarify which file you want me to edit?",
|
||||
partial: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// Wait for sound to be played
|
||||
await waitFor(() => {
|
||||
expect(mockPlayFunction).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
it("does not play notification sound when followup ask is partial", async () => {
|
||||
renderChatView()
|
||||
|
||||
// First hydrate state with initial task
|
||||
mockPostMessage({
|
||||
soundEnabled: true,
|
||||
messageQueue: [],
|
||||
clineMessages: [
|
||||
{
|
||||
type: "say",
|
||||
say: "task",
|
||||
ts: Date.now() - 2000,
|
||||
text: "Initial task",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// Clear any initial calls
|
||||
mockPlayFunction.mockClear()
|
||||
|
||||
// Add a partial followup ask message
|
||||
mockPostMessage({
|
||||
soundEnabled: true,
|
||||
messageQueue: [],
|
||||
clineMessages: [
|
||||
{
|
||||
type: "say",
|
||||
say: "task",
|
||||
ts: Date.now() - 2000,
|
||||
text: "Initial task",
|
||||
},
|
||||
{
|
||||
type: "ask",
|
||||
ask: "followup",
|
||||
ts: Date.now(),
|
||||
text: "Could you clarify...",
|
||||
partial: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// Wait a bit to ensure the effect would have run
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(mockPlayFunction).not.toHaveBeenCalled()
|
||||
},
|
||||
{ timeout: 1000 },
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("ChatView - Sound Debounce", () => {
|
||||
beforeEach(() => vi.clearAllMocks())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue