Files
orca/config/scripts/audit-localization-coverage.test.mjs
T
Jinjing 5a8237a7a5 Browser tab placement review (#23462)
* Implement source-following placement for browser tabs

- Add afterTabId and executionHostId parameters to track and anchor new tabs after their source
- Resolve source browser pages to unified tab wrappers for background link opens
- Implement anchor-based insertion that respects pinned tab boundaries
- Stage source-adjacent rows before host RPC for paired browser creation
- Ensure duplicated tabs and background links place directly after their source
- Add comprehensive test coverage for placement scenarios across single/split groups

* Preserve tab strip scroll anchor when tabs are added

Keep the viewed tab stable on screen when other tabs are inserted around it.
Records the active tab's on-screen position before insertions and restores it
after, so the user's focused tab doesn't jump unexpectedly. Matches the behavior
of VS Code and Chrome.

* Refine browser tab placement: fix host handling and sort-order gaps

- Avoid reordering unified tabs when the computed order matches the current order
- Do not substitute execution host for browser tab wrappers; let createUnifiedTab apply its active-workspace fallback instead
- Always apply sort values after tab insertion to prevent sortOrder gaps from preview replacement
- Fix import path for paired browser tab creation and clarify registration comments

* refactor(tests): use paired-browser-tab-creator registry for browser tab

- Replace direct web-runtime-session mock with paired-browser-tab-creator pattern
- Add test-rig file naming convention to localization audit skip list
2026-09-27 18:08:09 -07:00

66 lines
2.4 KiB
JavaScript

import { describe, expect, it } from 'vitest'
import { collectLocalizationCandidates, isSkippedFile } from './audit-localization-coverage.mjs'
const ROOT = process.cwd()
function candidates(fileName, source) {
return collectLocalizationCandidates(`${ROOT}/src/renderer/src/${fileName}`, source, ROOT)
}
describe('localization coverage candidates', () => {
it('sees copy guarded by a nullish or logical fallback', () => {
const reports = candidates(
'Sample.tsx',
`export function Sample({ label, connecting }) {
return <span>{label ?? (connecting ? 'Connecting…' : 'Idle')}</span>
}`
)
expect(reports.map((report) => report.text)).toEqual(['Connecting…', 'Idle'])
})
it('sees copy nested inside a conditional JSX guard', () => {
const reports = candidates(
'Sample.tsx',
`export function Sample({ show }) {
return <div>{show && <button aria-label="Retry the sync" />}</div>
}`
)
expect(reports.map((report) => report.text)).toEqual(['Retry the sync'])
})
it('ignores literals used as comparison operands', () => {
const reports = candidates(
'Sample.tsx',
`export function Sample({ phase }) {
return <span>{phase === 'workspace conflict' ? phase : null}</span>
}`
)
expect(reports).toEqual([])
})
})
describe('localization coverage file skipping', () => {
function skipped(relativePath) {
return isSkippedFile(ROOT, `${ROOT}/${relativePath}`)
}
it('skips test-only modules that sit beside their spec', () => {
expect(skipped('src/renderer/src/components/browser-pane/stream-test-harness.ts')).toBe(true)
expect(skipped('src/renderer/src/runtime/browser-tab-creation-test-rig.ts')).toBe(true)
expect(skipped('src/renderer/src/hooks/ipc-events-test-fixtures.ts')).toBe(true)
expect(skipped('src/renderer/src/lib/session-test-state.ts')).toBe(true)
expect(skipped('src/renderer/src/store/slices/routing-fixture.ts')).toBe(true)
expect(skipped('src/renderer/src/components/tab-bar/icon-stub.fixture.tsx')).toBe(true)
})
it('still scans shipped modules whose names merely mention a fixture concept', () => {
expect(skipped('src/renderer/src/components/browser-pane/fixture-picker.tsx')).toBe(false)
expect(skipped('src/renderer/src/components/settings/fixtures-panel.tsx')).toBe(false)
expect(skipped('src/renderer/src/components/browser-pane/BrowserPane.tsx')).toBe(false)
})
})