Merge branch 'main' into brennanb2025/mobile-0.0.21-release-links

This commit is contained in:
Brennan Benson
2026-07-03 13:31:06 -07:00
committed by GitHub
4 changed files with 71 additions and 8 deletions
+2 -2
View File
@@ -647,10 +647,10 @@ describe('CdpWsProxy', () => {
})
it('does not register a PDF stream when the client disconnects mid-print', async () => {
let resolvePrint: (buf: Buffer) => void = () => {}
let resolvePrint: (buf: Buffer<ArrayBuffer>) => void = () => {}
mock.webContents.printToPDF.mockImplementationOnce(
() =>
new Promise<Buffer>((resolve) => {
new Promise<Buffer<ArrayBuffer>>((resolve) => {
resolvePrint = resolve
})
)
+2 -2
View File
@@ -362,8 +362,8 @@ export default function Landing(): React.JSX.Element {
onClick={() => openModal('new-workspace-composer', { telemetrySource: 'unknown' })}
>
<GitBranchPlus className="size-3.5" />
{translate('auto.components.Landing.76a95f7f47', 'Create')}
{createTargetLabel}
{translate('auto.components.Landing.76a95f7f47', 'Create')}{' '}
{createTargetLabel.toLowerCase()}
</button>
</div>
@@ -1,6 +1,9 @@
// @vitest-environment happy-dom
import { act, type ReactNode } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import { renderToStaticMarkup } from 'react-dom/server'
import type { ReactNode } from 'react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { SidebarSettingsHelpMenu } from './SidebarSettingsHelpMenu'
const mocks = vi.hoisted(() => ({
@@ -20,6 +23,7 @@ const mocks = vi.hoisted(() => ({
}))
let updateStatus = { state: 'idle' } as const
const roots: Root[] = []
vi.mock('@/store', () => ({
useAppStore: (selector: (state: unknown) => unknown) =>
@@ -96,9 +100,48 @@ vi.mock('./SidebarFeedbackDialog', () => ({
SidebarFeedbackDialog: () => <div data-testid="feedback-dialog" />
}))
function installWindowApi(): void {
Object.assign(window, {
api: {
app: {
restart: mocks.appRestart
},
shell: {
openUrl: mocks.shellOpenUrl
},
updater: {
check: mocks.updaterCheck
}
}
})
}
async function renderMenu(): Promise<HTMLDivElement> {
const container = document.createElement('div')
document.body.appendChild(container)
const root = createRoot(container)
roots.push(root)
await act(async () => {
root.render(<SidebarSettingsHelpMenu />)
})
return container
}
function findMenuItem(container: HTMLElement, label: string): HTMLButtonElement {
const button = Array.from(
container.querySelectorAll<HTMLButtonElement>('[data-testid="menu-item"]')
).find((element) => element.textContent?.includes(label))
expect(button).toBeDefined()
return button as HTMLButtonElement
}
describe('SidebarSettingsHelpMenu', () => {
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
vi.clearAllMocks()
installWindowApi()
mocks.useShortcutKeyDetails.mockReturnValue({ keys: ['⌘', ','], doubleTap: false })
updateStatus = { state: 'idle' }
mocks.setupProgress = {
@@ -109,6 +152,13 @@ describe('SidebarSettingsHelpMenu', () => {
}
})
afterEach(() => {
roots.splice(0).forEach((root) => {
act(() => root.unmount())
})
document.body.replaceChildren()
})
it('renders the help button with correct aria-label', () => {
const html = renderToStaticMarkup(<SidebarSettingsHelpMenu />)
expect(html).toContain('Help')
@@ -177,6 +227,19 @@ describe('SidebarSettingsHelpMenu', () => {
it('renders Discord link', () => {
const html = renderToStaticMarkup(<SidebarSettingsHelpMenu />)
expect(html).toContain('Discord')
expect(html).toContain('viewBox="0 0 20 20"')
expect(html).toContain('M16.0742 4.45014C14.9244 3.92097 13.7106 3.54556 12.4638 3.3335')
})
it('opens Discord invite through the shell bridge', async () => {
const container = await renderMenu()
const discordButton = findMenuItem(container, 'Discord')
await act(async () => {
discordButton.click()
})
expect(mocks.shellOpenUrl).toHaveBeenCalledWith('https://discord.gg/fzjDKHxv8Q')
})
it('renders X link', () => {
@@ -46,8 +46,8 @@ function openExternalUrl(url: string): void {
function DiscordIcon(): React.JSX.Element {
return (
<svg viewBox="0 0 24 24" aria-hidden="true" className="size-3.5 fill-current">
<path d="M20.317 4.369A19.791 19.791 0 0 0 15.885 3c-.191.328-.403.77-.553 1.116a18.27 18.27 0 0 0-5.098 0A12.64 12.64 0 0 0 9.68 3a19.736 19.736 0 0 0-4.433 1.369C2.444 8.479 1.69 12.488 2.067 16.44a19.912 19.912 0 0 0 5.427 2.744c.438-.598.828-1.23 1.164-1.89a12.95 12.95 0 0 1-1.833-.877c.154-.113.305-.231.45-.352a14.294 14.294 0 0 0 12.45 0c.146.12.296.239.45.352-.585.34-1.2.634-1.835.878.337.659.727 1.29 1.165 1.888a19.84 19.84 0 0 0 5.43-2.744c.442-4.579-.755-8.551-3.932-12.07ZM9.955 14.005c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.418 2.157-2.418 1.211 0 2.176 1.095 2.157 2.418 0 1.334-.955 2.419-2.157 2.419Zm4.09 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.418 2.157-2.418 1.211 0 2.176 1.095 2.157 2.418 0 1.334-.946 2.419-2.157 2.419Z" />
<svg viewBox="0 0 20 20" aria-hidden="true" className="size-3.5 fill-current">
<path d="M16.0742 4.45014C14.9244 3.92097 13.7106 3.54556 12.4638 3.3335C12.2932 3.64011 12.1388 3.95557 12.0013 4.27856C10.6732 4.07738 9.32261 4.07738 7.99451 4.27856C7.85694 3.9556 7.70257 3.64014 7.53203 3.3335C6.28441 3.54735 5.06981 3.92365 3.91889 4.45291C1.63401 7.85128 1.01462 11.1652 1.32431 14.4322C2.6624 15.426 4.16009 16.1819 5.7523 16.6668C6.11082 16.1821 6.42806 15.6678 6.70066 15.1295C6.18289 14.9351 5.68315 14.6953 5.20723 14.4128C5.33249 14.3215 5.45499 14.2274 5.57336 14.136C6.95819 14.7907 8.46965 15.1302 9.99997 15.1302C11.5303 15.1302 13.0418 14.7907 14.4266 14.136C14.5463 14.2343 14.6688 14.3284 14.7927 14.4128C14.3159 14.6957 13.8152 14.9361 13.2965 15.1309C13.5688 15.669 13.8861 16.1828 14.2449 16.6668C15.8385 16.1838 17.3373 15.4283 18.6756 14.4335C19.039 10.645 18.0549 7.36145 16.0742 4.45014ZM7.09294 12.423C6.22992 12.423 5.51693 11.6357 5.51693 10.6671C5.51693 9.69852 6.20514 8.90427 7.09019 8.90427C7.97524 8.90427 8.68272 9.69852 8.66758 10.6671C8.65244 11.6357 7.97248 12.423 7.09294 12.423ZM12.907 12.423C12.0426 12.423 11.3324 11.6357 11.3324 10.6671C11.3324 9.69852 12.0206 8.90427 12.907 8.90427C13.7934 8.90427 14.4954 9.69852 14.4803 10.6671C14.4651 11.6357 13.7865 12.423 12.907 12.423Z" />
</svg>
)
}