test: cover split terminal first-responder focus recovery
This commit is contained in:
parent
dea60ea71c
commit
d230180009
1 changed files with 37 additions and 0 deletions
|
|
@ -4688,6 +4688,43 @@ final class TabManagerEqualizeSplitsTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class WorkspaceTerminalFocusRecoveryTests: XCTestCase {
|
||||
func testTerminalFirstResponderConvergesSplitActiveStateWhenSelectionAlreadyMatches() {
|
||||
let workspace = Workspace()
|
||||
guard let leftPanelId = workspace.focusedPanelId,
|
||||
let leftPanel = workspace.terminalPanel(for: leftPanelId),
|
||||
let rightPanel = workspace.newTerminalSplit(from: leftPanelId, orientation: .horizontal) else {
|
||||
XCTFail("Expected split terminal panels")
|
||||
return
|
||||
}
|
||||
|
||||
XCTAssertEqual(
|
||||
workspace.focusedPanelId,
|
||||
rightPanel.id,
|
||||
"Expected the new split panel to be selected before simulating stale focus state"
|
||||
)
|
||||
|
||||
// Simulate the split-pane failure mode: Bonsplit already points at the right panel,
|
||||
// but the active terminal state is still stale on the left panel.
|
||||
leftPanel.surface.setFocus(true)
|
||||
leftPanel.hostedView.setActive(true)
|
||||
rightPanel.surface.setFocus(false)
|
||||
rightPanel.hostedView.setActive(false)
|
||||
|
||||
workspace.focusPanel(rightPanel.id, trigger: .terminalFirstResponder)
|
||||
|
||||
XCTAssertFalse(
|
||||
leftPanel.hostedView.debugRenderStats().isActive,
|
||||
"Expected stale left-pane active state to be cleared"
|
||||
)
|
||||
XCTAssertTrue(
|
||||
rightPanel.hostedView.debugRenderStats().isActive,
|
||||
"Expected terminal-first-responder recovery to reactivate the selected split pane"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class WorkspaceTerminalConfigInheritanceSelectionTests: XCTestCase {
|
||||
func testPrefersSelectedTerminalInTargetPaneOverFocusedTerminalElsewhere() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue