Improve loads of fancy things in relation to the mouse pointer
This commit is contained in:
@@ -23,5 +23,63 @@ import Testing
|
||||
|
||||
@Test func theMenuHasNoHeader() {
|
||||
#expect(ContextActions.header(for: .terminal(.agent, hasSelection: false), projectName: "app").isEmpty)
|
||||
#expect(ContextActions.header(for: .directory(path: "src"), projectName: "app").isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
@Suite struct EditorContextMenuTests {
|
||||
private let reference = AgentReference(path: "src/a.php", startLine: 12)
|
||||
|
||||
@Test func theEditorMenuHasNoHeader() {
|
||||
#expect(ContextActions.header(for: .editor(reference: reference, code: nil), projectName: "app").isEmpty)
|
||||
#expect(ContextActions.header(for: .editor(reference: reference, code: "x", showDiffLine: 12), projectName: "app").isEmpty)
|
||||
}
|
||||
|
||||
@Test func fileGitRowAndRootMenusKeepTheirHeader() {
|
||||
#expect(ContextActions.header(for: .file(path: "src/a.php"), projectName: "app") == "src/a.php")
|
||||
#expect(ContextActions.header(for: .gitRow(path: "src/a.php", staged: false), projectName: "app") == "src/a.php")
|
||||
#expect(ContextActions.header(for: .projectRoot, projectName: "app") == "app/")
|
||||
}
|
||||
|
||||
@Test func aMarkedLineEndsWithShowDiffAtThatLine() {
|
||||
#expect(ContextActions.entries(for: .editor(reference: reference, code: nil, showDiffLine: 12)) == [
|
||||
.action(.passOnReference("src/a.php:12", code: nil), label: "Pass on reference"),
|
||||
.action(.copyReference("src/a.php:12"), label: "Copy reference"),
|
||||
.separator,
|
||||
.action(.showDiff("src/a.php", line: 12), label: "Show diff"),
|
||||
])
|
||||
}
|
||||
|
||||
@Test func anUnchangedLineHasNoShowDiff() {
|
||||
#expect(ContextActions.entries(for: .editor(reference: reference, code: nil)) == [
|
||||
.action(.passOnReference("src/a.php:12", code: nil), label: "Pass on reference"),
|
||||
.action(.copyReference("src/a.php:12"), label: "Copy reference"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@Suite struct BouwenContextMenuTests {
|
||||
private func hasBouwen(_ target: ContextTarget) -> Bool {
|
||||
ContextActions.entries(for: target).contains { entry in
|
||||
guard case .action(.bouwen, _) = entry else { return false }
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@Test func anOntwikkelingFolderStartsWithBouwen() {
|
||||
let entries = ContextActions.entries(for: .directory(path: "ontwikkelingen/2026-10-02-001-x"))
|
||||
#expect(Array(entries.prefix(3)) == [
|
||||
.action(.bouwen("2026-10-02-001-x"), label: "Bouwen"),
|
||||
.separator,
|
||||
.action(.passOnReference("ontwikkelingen/2026-10-02-001-x/", code: nil), label: "Pass on reference"),
|
||||
])
|
||||
}
|
||||
|
||||
@Test func otherPathsHaveNoBouwen() {
|
||||
#expect(!hasBouwen(.directory(path: "ontwikkelingen")))
|
||||
#expect(!hasBouwen(.directory(path: "ontwikkelingen/ontwikkeld")))
|
||||
#expect(!hasBouwen(.directory(path: "ontwikkelingen/a/b")))
|
||||
#expect(!hasBouwen(.directory(path: "src/ontwikkelingen/a")))
|
||||
#expect(!hasBouwen(.file(path: "ontwikkelingen/a")))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user