Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/cli/src/ui/components/HistoryItemDisplay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vi.mock('../hooks/useMouseEvents.js', () => ({
useMouseEvents: vi.fn(),
}));

import { toggleKeyHint } from './messages/ConversationMessages.js';

describe('<HistoryItemDisplay />', () => {
const mockConfig = {
getChatRecordingService: () => undefined,
Expand Down Expand Up @@ -358,7 +360,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Inspecting the repository');
});

Expand Down Expand Up @@ -394,7 +396,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Inspecting the repository');
});

Expand All @@ -414,7 +416,7 @@ describe('<HistoryItemDisplay />', () => {

const output = lastFrame() ?? '';
expect(output).toContain('Thought for');
expect(output).toContain('alt+t to collapse');
expect(output).toContain(`${toggleKeyHint} to collapse`);
expect(output).toContain('Inspecting the repository');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
*/

import { render } from 'ink-testing-library';
import { ThinkMessage, ThinkMessageContent } from './ConversationMessages.js';
import {
ThinkMessage,
ThinkMessageContent,
toggleKeyHint,
} from './ConversationMessages.js';

describe('<ThinkMessage />', () => {
const defaultProps = {
Expand All @@ -19,7 +23,7 @@ describe('<ThinkMessage />', () => {
);
const output = lastFrame();
expect(output).toContain('Thinking');
expect(output).not.toContain('alt+t to expand');
expect(output).not.toContain(`${toggleKeyHint} to expand`);
});

it('should render collapsed line when committed and not expanded', () => {
Expand All @@ -28,7 +32,7 @@ describe('<ThinkMessage />', () => {
);
const output = lastFrame();
expect(output).toContain('Thinking');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Analyzing the code structure');
});

Expand All @@ -45,7 +49,7 @@ describe('<ThinkMessage />', () => {
<ThinkMessage {...defaultProps} isPending={false} />,
);
const output = lastFrame();
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
expect(output).not.toContain('Analyzing the code structure');
});

Expand All @@ -61,7 +65,7 @@ describe('<ThinkMessage />', () => {
const output = lastFrame();
expect(output).toContain('Thought for');
expect(output).toContain('15s');
expect(output).toContain('alt+t to expand');
expect(output).toContain(`${toggleKeyHint} to expand`);
});

it('should show present-tense duration while pending (streaming)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { formatDuration } from '../../utils/displayUtils.js';

export const THINKING_ICON = '∴ ';

export const toggleKeyHint =
process.platform === 'darwin' ? 'option+t' : 'alt+t';

interface UserMessageProps {
text: string;
}
Expand Down Expand Up @@ -329,7 +332,7 @@ export const ThinkMessage: React.FC<ThinkMessageProps> = ({
return (
<Text dimColor italic>
{THINKING_ICON}
{label} {t('(alt+t to expand)')}
{label} {t('({{keyHint}} to expand)', { keyHint: toggleKeyHint })}
</Text>
);
}
Expand Down Expand Up @@ -370,7 +373,8 @@ export const ThinkMessage: React.FC<ThinkMessageProps> = ({
<Box flexDirection="column">
<Text dimColor italic>
{THINKING_ICON}
{expandedLabel} {t('(alt+t to collapse)')}
{expandedLabel}{' '}
{t('({{keyHint}} to collapse)', { keyHint: toggleKeyHint })}
</Text>
<Box paddingLeft={2} flexDirection="column">
<MarkdownDisplay
Expand Down
Loading