Repository navigation
fix(ios): present the todo surface instead of a black screen in terminal-less workspaces #10464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
175e6e3
test(ios): a todo-only workspace must present its todo surface by def…
azooz2003-bit 57edbcb
fix(ios): present the todo surface instead of a black screen in termi…
azooz2003-bit d714be5
fix: route mobile todo/status/surface-focus/panel-artifact RPCs; keep…
azooz2003-bit 2bd5219
review: stale surface selection falls back like nil; explicit allowsM…
azooz2003-bit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...hellModel/Tests/CmuxMobileShellModelTests/MobileWorkspacePreviewDefaultSurfaceTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import CMUXMobileCore | ||
| import Testing | ||
| @testable import CmuxMobileShellModel | ||
|
|
||
| /// Covers the surface shown when the picker has no explicit Mac-surface | ||
| /// selection. A workspace whose panes are all non-terminal (for example a | ||
| /// lone todo panel) has no terminal to stream, so without a fallback the | ||
| /// detail view renders an empty terminal background. | ||
| struct MobileWorkspacePreviewDefaultSurfaceTests { | ||
| private func surface( | ||
| id: MobileSurfacePreview.ID, | ||
| kind: MobileSurfacePreview.Kind, | ||
| todo: MobileTodoSnapshot? = nil | ||
| ) -> MobileSurfacePreview { | ||
| MobileSurfacePreview(id: id, kind: kind, title: "Surface", todo: todo) | ||
| } | ||
|
|
||
| private func workspace( | ||
| terminals: [MobileTerminalPreview], | ||
| surfaces: [MobileSurfacePreview] | ||
| ) -> MobileWorkspacePreview { | ||
| MobileWorkspacePreview( | ||
| id: "workspace-1", | ||
| name: "TODO - iOS", | ||
| terminals: terminals, | ||
| surfaces: surfaces | ||
| ) | ||
| } | ||
|
|
||
| private var todoSurface: MobileSurfacePreview { | ||
| surface( | ||
| id: "surface-todo", | ||
| kind: .todo, | ||
| todo: MobileTodoSnapshot(status: .todo, statusHidden: false, items: []) | ||
| ) | ||
| } | ||
|
|
||
| @Test func noTerminalsFallsBackToFirstNonTerminalSurface() { | ||
| let workspace = workspace(terminals: [], surfaces: [todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: nil) == todoSurface) | ||
| } | ||
|
|
||
| @Test func fallbackSkipsTerminalKindedSurfaces() { | ||
| let terminalSurface = surface(id: "surface-term", kind: .terminal) | ||
| let workspace = workspace(terminals: [], surfaces: [terminalSurface, todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: nil) == todoSurface) | ||
| } | ||
|
|
||
| @Test func fallbackPicksFirstNonTerminalSurfaceInSpatialOrder() { | ||
| let browserSurface = surface(id: "surface-browser", kind: .browser) | ||
| let workspace = workspace(terminals: [], surfaces: [browserSurface, todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: nil) == browserSurface) | ||
| } | ||
|
|
||
| @Test func staleSelectionFallsBackWhenTerminalless() { | ||
| let workspace = workspace(terminals: [], surfaces: [todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: "surface-closed") == todoSurface) | ||
| } | ||
|
|
||
| @Test func staleSelectionKeepsTerminalWhenTerminalsExist() { | ||
| let terminal = MobileTerminalPreview(id: "terminal-1", name: "zsh") | ||
| let workspace = workspace(terminals: [terminal], surfaces: [todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: "surface-closed") == nil) | ||
| } | ||
|
|
||
| @Test func explicitSelectionStillWins() { | ||
| let browserSurface = surface(id: "surface-browser", kind: .browser) | ||
| let workspace = workspace(terminals: [], surfaces: [todoSurface, browserSurface]) | ||
| #expect(workspace.selectedMacSurface(id: browserSurface.id) == browserSurface) | ||
| } | ||
|
|
||
| @Test func terminalsPresentKeepTerminalAsDefault() { | ||
| let terminal = MobileTerminalPreview(id: "terminal-1", name: "zsh") | ||
| let workspace = workspace(terminals: [terminal], surfaces: [todoSurface]) | ||
| #expect(workspace.selectedMacSurface(id: nil) == nil) | ||
| } | ||
|
|
||
| @Test func noNonTerminalSurfacesReturnsNil() { | ||
| let terminalSurface = surface(id: "surface-term", kind: .terminal) | ||
| let workspace = workspace(terminals: [], surfaces: [terminalSurface]) | ||
| #expect(workspace.selectedMacSurface(id: nil) == nil) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.