Repository navigation
fix(wsl): a held pane whose distro could not be checked says so, not that it stopped #35860
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
+170
−49
Merged
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions
50
src/renderer/src/components/terminal-pane/WslDistroStoppedHoldCard.test.tsx
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,50 @@ | ||
| // @vitest-environment happy-dom | ||
|
|
||
| import '@testing-library/jest-dom/vitest' | ||
| import { cleanup, render, screen } from '@testing-library/react' | ||
| import userEvent from '@testing-library/user-event' | ||
| import { afterEach, describe, expect, it, vi } from 'vitest' | ||
| import { makePaneKey } from '../../../../shared/stable-pane-id' | ||
| import { WslDistroStoppedHoldCard } from './WslDistroStoppedHoldCard' | ||
| import { | ||
| holdPaneForStoppedWslDistro, | ||
| wslDistroStoppedHoldStore | ||
| } from './wsl-distro-stopped-hold-state' | ||
|
|
||
| vi.mock('@/i18n/i18n', () => ({ | ||
| translate: (_key: string, fallback: string, options?: Record<string, string>) => | ||
| fallback.replace(/\{\{(\w+)\}\}/g, (_match, name: string) => options?.[name] ?? ''), | ||
| getIntlLocale: () => 'en-US' | ||
| })) | ||
|
|
||
| const TAB = '11111111-1111-4111-8111-111111111111' | ||
| const LEAF = '22222222-2222-4222-8222-222222222222' | ||
|
|
||
| afterEach(() => { | ||
| cleanup() | ||
| wslDistroStoppedHoldStore.setState({ panes: {} }) | ||
| }) | ||
|
|
||
| function holdPane(state: 'stopped' | 'unverifiable') { | ||
| const release = vi.fn(async () => {}) | ||
| holdPaneForStoppedWslDistro(makePaneKey(TAB, LEAF), { distro: 'Ubuntu', state, release }) | ||
| render(<WslDistroStoppedHoldCard tabId={TAB} leafId={LEAF} />) | ||
| return release | ||
| } | ||
|
|
||
| describe('a restored WSL bridge pane held for its distro (E9)', () => { | ||
| it('says the distro is stopped when the read found it stopped', () => { | ||
| holdPane('stopped') | ||
| expect(screen.getByText('Ubuntu is stopped')).toBeInTheDocument() | ||
| }) | ||
|
|
||
| // The read gave no answer, so the card must not claim the distro stopped. | ||
| it("says Orca couldn't check when the read could not tell, and still offers Start", async () => { | ||
| const release = holdPane('unverifiable') | ||
| expect(screen.getByText("Orca couldn't check whether Ubuntu is running")).toBeInTheDocument() | ||
| expect(screen.queryByText('Ubuntu is stopped')).not.toBeInTheDocument() | ||
|
|
||
| await userEvent.setup().click(screen.getByRole('button', { name: 'Start' })) | ||
| expect(release).toHaveBeenCalledOnce() | ||
| }) | ||
| }) |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The longer title can hide the distro name in narrow split panes.
RemoteRuntimeRecoveryCardputs the title on one line withtruncate, so users may see only “Orca couldn't check whether…” beside Start. Let this message wrap, or put it in the card's wrapping body, so users can read which distro could not be checked.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!