mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 08:04:05 +00:00
test(mobile): lock quick-commands button stability
Add a focused source-contract test for the always-mounted tab action and confirmed-support sheet gate. Keep the non-obvious safety comment concise, and remove PR screenshots now hosted as GitHub user attachments.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 123 KiB |
@@ -4514,7 +4514,7 @@ export default function SessionScreen() {
|
||||
>
|
||||
<Plus size={16} color={colors.textSecondary} strokeWidth={2.2} />
|
||||
</Pressable>
|
||||
{/* Why: always render so the tab row never shifts while capabilities load; the tap explains unsupported/probing hosts instead. Old hosts strip agentPrompt, so the sheet only opens once support is confirmed. */}
|
||||
{/* Why: stable placement matters, while old hosts must stay gated because they strip agentPrompt. */}
|
||||
<QuickCommandsTabButton
|
||||
disabled={
|
||||
creating || creatingBrowser || creatingMarkdown || connState !== 'connected'
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const source = readFileSync(
|
||||
new URL('../../app/h/[hostId]/session/[worktreeId].tsx', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
function getQuickCommandsTabSource(): string {
|
||||
const start = source.indexOf('accessibilityLabel="New tab"')
|
||||
expect(start).toBeGreaterThanOrEqual(0)
|
||||
const end = source.indexOf('{/* Content-row host', start)
|
||||
expect(end).toBeGreaterThan(start)
|
||||
return source.slice(start, end)
|
||||
}
|
||||
|
||||
describe('quick-commands tab stability', () => {
|
||||
it('keeps the button mounted while preserving the capability gate', () => {
|
||||
const tabSource = getQuickCommandsTabSource()
|
||||
|
||||
expect(tabSource).toContain('<QuickCommandsTabButton')
|
||||
expect(tabSource).not.toContain('{quickCommandsSupported === true ?')
|
||||
expect(tabSource).toContain('if (quickCommandsSupported === true)')
|
||||
expect(tabSource).toContain('setShowQuickCommands(true)')
|
||||
expect(tabSource).toContain('Desktop update required for quick commands')
|
||||
expect(tabSource).toContain('Checking desktop capabilities — try again in a moment')
|
||||
})
|
||||
|
||||
it('only presents the sheet after support is confirmed', () => {
|
||||
expect(source).toContain('visible={showQuickCommands && quickCommandsSupported === true}')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user