Skip to content
Open
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
27 changes: 24 additions & 3 deletions apps/mobile/src/components/agents/session-detail-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ function page(
// resolves with this cursor instead of the default `null`.
let rootPageNextCursor: string | null = null;

// Set before `mountDetails` by the long-title header tests; `fetchSession`
// reports this session title instead of the short default.
let sessionTitleOverride: string | null = null;

function messageLists(renderer: ReactTestRenderer): ReactTestInstance[] {
return renderer.root.findAll(node => Object.is(node.type, 'MessageList'));
}
Expand All @@ -575,6 +579,7 @@ beforeEach(() => {
globalContext.organizationId = 'global-org';
globalContext.setOrganizationId.mockClear();
rootPageNextCursor = null;
sessionTitleOverride = null;
condensePreference.value = false;
connectionHealth.isConnected = true;
connectionHealth.reconnectExhausted = false;
Expand Down Expand Up @@ -662,7 +667,7 @@ async function mountDetails(
return {
kiloSessionId: id,
cloudAgentSessionId: null,
title: `Root ${id}`,
title: sessionTitleOverride ?? `Root ${id}`,
organizationId: null,
gitUrl: null,
gitBranch: null,
Expand Down Expand Up @@ -831,7 +836,7 @@ describe('SessionDetailContent display scope', () => {
});
const header = renderer.root.findByType(ScreenHeader);
expect(header.findByProps({ accessibilityRole: 'header' }).props).toMatchObject({
numberOfLines: 2,
numberOfLines: 1,
ellipsizeMode: 'tail',
});
expect(header.findByProps({ accessibilityRole: 'header' }).parent?.props.className).toContain(
Expand All @@ -857,6 +862,22 @@ describe('SessionDetailContent display scope', () => {
});
});

describe('SessionDetailContent header title', () => {
// The title shares its row with a 44pt context pill and a copy action, so on
// a narrow phone the title column is a fraction of the row width. Letting the
// Text wrap there split a long word across two lines and truncated the second
// ("Moving-ave / rage empt…"). One line keeps the truncation at a clean tail
// ellipsis instead of breaking a word across two lines.
it('keeps a long session title on one line instead of breaking a word across two', async () => {
sessionTitleOverride = 'Moving-average rage empty baseline';
const { renderer } = await mountDetails();
const header = renderer.root.findByType(ScreenHeader);
const title = header.findByProps({ accessibilityRole: 'header' });
expect(title.props.numberOfLines).toBe(1);
expect(title.props.ellipsizeMode).toBe('tail');
});
});

describe('session detail status placement', () => {
it.each(['progress', 'info'] as const)(
'centers a %s status without transcript rows',
Expand Down Expand Up @@ -1445,7 +1466,7 @@ describe.each([true, false])('session detail return with history=%s', hasHistory

const header = view.renderer.root.findByType(ScreenHeader);
expect(header.findByProps({ accessibilityRole: 'header' }).props).toMatchObject({
numberOfLines: 2,
numberOfLines: 1,
ellipsizeMode: 'tail',
});
expect(header.findByProps({ accessibilityRole: 'header' }).parent?.props.className).toContain(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,7 @@ export function SessionDetailContent({
) : null}
<ScreenHeader
title={rename.title}
titleNumberOfLines={1}
reserveTitleSpace
backFallback="/(app)/(tabs)/(2_agents)"
headerRight={headerRight}
Expand Down
Loading