* feat(chat): add desktop prompt navigator rail Add a ChatGPT-style right-center prompt marker rail for web/desktop chat with hover/keyboard preview panel, load-more for partial history (panel only), Chat setting, and mod+alt+p shortcut. Disabled in VS Code across rail, shortcut, settings, help, and search surfaces. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> * fix(ui): read promptNavigatorEnabled from getState in shortcut handler Match the file convention used by other shortcut handlers so the toggle does not rely on a hook-level selector closure. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> * fix(ui): drop use-no-memo and default prompt navigator off Remove the project-unprecedented React Compiler opt-out, and ship the prompt navigator as opt-in to match other recent chat UI toggles. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
22 lines
846 B
TypeScript
22 lines
846 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import type { Part } from '@opencode-ai/sdk/v2'
|
|
import { getFullText, getMessagePreview } from './messagePreview'
|
|
|
|
const textPart = (text: string): Part => ({ type: 'text', text } as Part)
|
|
|
|
describe('messagePreview', () => {
|
|
test('joins text parts for full text', () => {
|
|
expect(getFullText([textPart('hello'), textPart('world')])).toBe('hello\nworld')
|
|
})
|
|
|
|
test('collapses newlines and truncates previews', () => {
|
|
expect(getMessagePreview([textPart('line one\nline two')], 80)).toBe('line one line two')
|
|
expect(getMessagePreview([textPart('abcdefghijklmnopqrstuvwxyz')], 10)).toBe('abcdefghij…')
|
|
})
|
|
|
|
test('returns empty string when there is no text', () => {
|
|
expect(getMessagePreview([])).toBe('')
|
|
expect(getFullText([{ type: 'file' } as Part])).toBe('')
|
|
})
|
|
})
|