updates plak menu item
This commit is contained in:
@@ -625,7 +625,7 @@ import Testing
|
||||
Issue.record("no context menu")
|
||||
return
|
||||
}
|
||||
#expect(menuLabels(menu) == ["Copy", "Paste", "Wait what?"])
|
||||
#expect(menuLabels(menu) == ["Copy", "Paste", "Read aloud selection", "Plak", "Wait what?"])
|
||||
#expect(menu.header.isEmpty)
|
||||
#expect(menu.anchor == CGPoint(x: 900, y: 300))
|
||||
}
|
||||
@@ -645,6 +645,68 @@ import Testing
|
||||
#expect(harness.toastTitles == ["Passed to agent"])
|
||||
}
|
||||
|
||||
@Test func readAloudSelectionReadsTheSelectionAsProse() async {
|
||||
let harness = WorkspaceHarness()
|
||||
harness.agent.selectedText = " Run **npm test** first.\n"
|
||||
await harness.perform(.context(.readAloudTerminalSelection(.agent)))
|
||||
#expect(harness.speech.spoken == ["Run npm test first."])
|
||||
#expect(harness.model.readAloud.isReading)
|
||||
}
|
||||
|
||||
@Test func readAloudSelectionReadsTheShellSelection() async {
|
||||
let harness = WorkspaceHarness()
|
||||
let shell = FakeTerminal()
|
||||
harness.model.terminal.attach(shell, as: .shell)
|
||||
shell.selectedText = "```\nls -la\n```"
|
||||
await harness.perform(.context(.readAloudTerminalSelection(.shell)))
|
||||
#expect(harness.speech.spoken == ["```\nls -la\n```"])
|
||||
}
|
||||
|
||||
@Test func readAloudSelectionWithBlankTextSaysSo() async {
|
||||
let harness = WorkspaceHarness()
|
||||
harness.agent.selectedText = " \n"
|
||||
await harness.perform(.context(.readAloudTerminalSelection(.agent)))
|
||||
#expect(harness.speech.spoken.isEmpty)
|
||||
#expect(harness.toastTitles == ["Nothing to read"])
|
||||
}
|
||||
|
||||
@Test func plakSendsTheTrimmedSelection() async {
|
||||
let harness = WorkspaceHarness()
|
||||
harness.agent.selectedText = " npm test\n"
|
||||
await harness.perform(.context(.plakTerminalSelection(.agent)))
|
||||
#expect(harness.system.plakked == ["npm test"])
|
||||
}
|
||||
|
||||
@Test func plakSendsTheShellSelection() async {
|
||||
let harness = WorkspaceHarness()
|
||||
let shell = FakeTerminal()
|
||||
harness.model.terminal.attach(shell, as: .shell)
|
||||
shell.selectedText = "ls -la"
|
||||
await harness.perform(.context(.plakTerminalSelection(.shell)))
|
||||
#expect(harness.system.plakked == ["ls -la"])
|
||||
}
|
||||
|
||||
@Test func plakWithBlankSelectionSaysSo() async {
|
||||
let harness = WorkspaceHarness()
|
||||
harness.agent.selectedText = " \n"
|
||||
await harness.perform(.context(.plakTerminalSelection(.agent)))
|
||||
#expect(harness.system.plakked.isEmpty)
|
||||
#expect(harness.toastTitles == ["Nothing to send"])
|
||||
}
|
||||
|
||||
@Test func plakSendsTheEditorSelection() async {
|
||||
let harness = WorkspaceHarness()
|
||||
await harness.perform(.context(.plak("\n $a = 1;\n")))
|
||||
#expect(harness.system.plakked == ["$a = 1;"])
|
||||
}
|
||||
|
||||
@Test func plakWithBlankEditorTextSaysSo() async {
|
||||
let harness = WorkspaceHarness()
|
||||
await harness.perform(.context(.plak(" \n ")))
|
||||
#expect(harness.system.plakked.isEmpty)
|
||||
#expect(harness.toastTitles == ["Nothing to send"])
|
||||
}
|
||||
|
||||
@Test func pasteSendsThePasteboardToThatTerminal() async {
|
||||
let harness = WorkspaceHarness()
|
||||
let shell = FakeTerminal()
|
||||
@@ -660,6 +722,12 @@ import Testing
|
||||
#expect(ContextMenuOverlay.tint(for: .pasteIntoTerminal(.shell)) == .plain)
|
||||
#expect(ContextMenuOverlay.symbol(for: .copyTerminalSelection(.agent)) == "doc.on.doc")
|
||||
#expect(ContextMenuOverlay.symbol(for: .pasteIntoTerminal(.agent)) == "doc.on.clipboard")
|
||||
#expect(ContextMenuOverlay.tint(for: .readAloudTerminalSelection(.agent)) == .plain)
|
||||
#expect(ContextMenuOverlay.symbol(for: .readAloudTerminalSelection(.shell)) == "speaker.wave.2")
|
||||
#expect(ContextMenuOverlay.tint(for: .plakTerminalSelection(.agent)) == .plain)
|
||||
#expect(ContextMenuOverlay.tint(for: .plak("x")) == .plain)
|
||||
#expect(ContextMenuOverlay.symbol(for: .plakTerminalSelection(.shell)) == "note.text.badge.plus")
|
||||
#expect(ContextMenuOverlay.symbol(for: .plak("x")) == "note.text.badge.plus")
|
||||
}
|
||||
|
||||
@Test func aProjectSwitchKeepsTheTerminalMenuWired() async {
|
||||
|
||||
Reference in New Issue
Block a user