adds schema view and schema generating command

This commit is contained in:
2026-11-03 09:35:41 +01:00
parent cc41decccb
commit 600d4874d2
62 changed files with 4416 additions and 105 deletions
@@ -195,4 +195,45 @@ import Testing
#expect(route(KeyPress(.character("c"), control: true)) == .pass)
#expect(route(KeyPress(.character("g"), command: true, option: true)) == .pass)
}
@Test func commandDTogglesTheSchemaViewOnlyInALaravelApp() {
#expect(route(cmd("d"), KeyContext(schemaAvailable: true)) == .perform(.toggleSchemaView))
#expect(route(cmd("d"), KeyContext(owner: .text(in: .editor), schemaAvailable: true)) == .perform(.toggleSchemaView))
#expect(route(cmd("d"), KeyContext(gitViewOpen: true, schemaAvailable: true)) == .perform(.toggleSchemaView))
#expect(route(cmd("d"), KeyContext(schemaAvailable: true, schemaViewOpen: true)) == .perform(.toggleSchemaView))
#expect(route(cmd("d")) == .pass)
#expect(route(cmd("d"), KeyContext(owner: .terminal)) == .pass)
}
@Test func escapeOverTheSchemaViewClearsTheSelectionThenTheSearchThenCloses() {
let open = KeyContext(schemaAvailable: true, schemaViewOpen: true)
#expect(route(KeyPress(.escape), open) == .perform(.closeSchemaView))
var selected = open
selected.schemaHasSelection = true
selected.schemaSearchHasText = true
#expect(route(KeyPress(.escape), selected) == .perform(.clearSchemaSelection))
var searching = open
searching.owner = .text(in: nil)
searching.schemaSearchHasText = true
#expect(route(KeyPress(.escape), searching) == .perform(.clearSchemaSearch))
var overlaid = selected
overlaid.overlay = .other
#expect(route(KeyPress(.escape), overlaid) == .perform(.dismissOverlay))
#expect(route(KeyPress(.escape, command: true), open) == .pass)
}
@Test func overTheSchemaViewTheColumnKeysRestAndNothingCommits() {
let schema = KeyContext(activePanel: .explorer, focusZone: .editor, recentFileCount: 3,
schemaAvailable: true, schemaViewOpen: true)
#expect(route(KeyPress(.down), schema) == .pass)
#expect(route(KeyPress(.enter), schema) == .pass)
#expect(route(KeyPress(.right, command: true), schema) == .pass)
#expect(route(KeyPress(.down, command: true), schema) == .pass)
#expect(route(KeyPress(.enter, command: true), schema) == .pass)
#expect(route(cmd("c"), schema) == .pass)
#expect(route(cmd("a"), schema) == .pass)
#expect(route(cmd("g"), schema) == .perform(.toggleGit))
#expect(route(cmd("f"), schema) == .perform(.showSearch(seed: "")))
#expect(route(KeyPress(.character("?")), schema) == .perform(.showShortcuts))
#expect(route(KeyPress(.character("?")), KeyContext(owner: .text(in: nil), schemaViewOpen: true)) == .pass)
}
}