adds nice git interface
This commit is contained in:
@@ -58,7 +58,7 @@ import Testing
|
||||
|
||||
@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: .gitRow(path: "src/a.php", isDeleted: false), projectName: "app") == "src/a.php")
|
||||
#expect(ContextActions.header(for: .projectRoot, projectName: "app") == "app/")
|
||||
}
|
||||
|
||||
@@ -122,15 +122,37 @@ import Testing
|
||||
.action(.readAloudFile("docs/guide.md"), label: "Read aloud"),
|
||||
.separator,
|
||||
])
|
||||
#expect(readAloud(.gitRow(path: "README.md", staged: true)) == [.action(.readAloudFile("README.md"), label: "Read aloud")])
|
||||
}
|
||||
|
||||
@Test func otherFilesCannot() {
|
||||
#expect(readAloud(.file(path: "src/app.php")).isEmpty)
|
||||
#expect(readAloud(.gitRow(path: "src/app.php", staged: false)).isEmpty)
|
||||
#expect(readAloud(.directory(path: "docs")).isEmpty)
|
||||
}
|
||||
|
||||
@Test func aGitRowOpensInTheEditorThenPassesOnItsPath() {
|
||||
#expect(ContextActions.entries(for: .gitRow(path: "src/a.php", isDeleted: false)) == [
|
||||
.action(.openFile("src/a.php"), label: "Open in editor"),
|
||||
.separator,
|
||||
.action(.passOnReference("src/a.php", code: nil), label: "Pass on reference"),
|
||||
.action(.copyReference("src/a.php"), label: "Copy reference"),
|
||||
])
|
||||
#expect(ContextActions.entries(for: .gitRow(path: "gone.php", isDeleted: true)) == [
|
||||
.action(.passOnReference("gone.php", code: nil), label: "Pass on reference"),
|
||||
.action(.copyReference("gone.php"), label: "Copy reference"),
|
||||
])
|
||||
#expect(ContextAction.openFile("src/a.php").isEmphasized)
|
||||
}
|
||||
|
||||
@Test func theCommitMenuOffersCommitAndABoldCommitAndPush() {
|
||||
#expect(ContextActions.header(for: .commitMenu, projectName: "app") == "")
|
||||
#expect(ContextActions.entries(for: .commitMenu) == [
|
||||
.action(.commit(andPush: false), label: "Commit"),
|
||||
.action(.commit(andPush: true), label: "Commit and push"),
|
||||
])
|
||||
#expect(ContextAction.commit(andPush: true).isEmphasized)
|
||||
#expect(!ContextAction.commit(andPush: false).isEmphasized)
|
||||
}
|
||||
|
||||
@Test func aSelectionCanBeReadAloudAfterCopyReference() {
|
||||
let reference = AgentReference(path: "src/a.php", startLine: 3, endLine: 4)
|
||||
#expect(ContextActions.entries(for: .editor(reference: reference, code: "$a = 1;", showDiffLine: 3)) == [
|
||||
|
||||
Reference in New Issue
Block a user