Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 优化任务标题行内改名布局 (#1365)

Dashe595ab2521b3
diff --git a/apps/desktop/src/renderer/__tests__/sessionRenameAiFill.test.ts b/apps/desktop/src/renderer/__tests__/sessionRenameAiFill.test.ts
index 26b731dbad..c959832484 100644
--- a/apps/desktop/src/renderer/__tests__/sessionRenameAiFill.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sessionRenameAiFill.test.ts
@@ -51,6 +51,47 @@ async function renderAndGenerate(onCommit: (raw: string) => void, onCancel: () =
}
describe('SessionRenameInput AI rename fills edit state', () => {
+ it('uses a neutral pill editor and reserves blue focus for keyboard navigation', () => {
+ const onCommit = vi.fn();
+ const { container } = render(
+ createElement(SessionRenameInput, {
+ sessionId: 's1',
+ value: '旧标题',
+ onValueChange: () => {},
+ onCommit,
+ onCancel: () => {},
+ }),
+ );
+
+ const input = container.querySelector('input')!;
+ const button = container.querySelector('button')!;
+ expect(input.classList.contains('rounded-full')).toBe(true);
+ expect(input.classList.contains('border')).toBe(true);
+ expect(input.classList.contains('border-[var(--border-default)]')).toBe(true);
+ expect(input.classList.contains('border-[1.5px]')).toBe(false);
+ expect(input.classList.contains('border-[var(--focus-ring)]')).toBe(false);
+ expect(input.classList.contains('ring-2')).toBe(false);
+
+ // Tab 到 Magic 后 Shift+Tab 回到 input:这是键盘聚焦,应出现蓝色软环。
+ fireEvent.blur(input, { relatedTarget: button });
+ fireEvent.focus(button);
+ fireEvent.blur(button, { relatedTarget: input });
+ fireEvent.focus(input);
+ expect(input.classList.contains('ring-2')).toBe(true);
+ expect(input.classList.contains('ring-[var(--focus-ring-soft)]')).toBe(true);
+ expect(onCommit).not.toHaveBeenCalled();
+
+ // 鼠标在输入框或 Magic 上继续操作时隐去蓝环,保留中性描边。
+ fireEvent.pointerDown(button);
+ expect(input.classList.contains('ring-2')).toBe(false);
+
+ // Magic 保留原有的小圆角几何,只补键盘 focus-visible 反馈。
+ expect(button.classList.contains('rounded')).toBe(true);
+ expect(button.classList.contains('rounded-full')).toBe(false);
+ expect(button.classList.contains('focus-visible:ring-2')).toBe(true);
+ expect(button.classList.contains('focus-visible:ring-[var(--focus-ring-soft)]')).toBe(true);
+ });
+
it('uses the active foreground for both rename controls on an active sidebar row', () => {
const { container } = render(createElement(SessionRenameInput, {
sessionId: 's1',
@@ -66,10 +107,45 @@ describe('SessionRenameInput AI rename fills edit state', () => {
const button = container.querySelector('button')!;
expect(input.classList.contains('text-sidebar-item-active-foreground')).toBe(true);
expect(input.classList.contains('text-foreground')).toBe(false);
+ expect(input.classList.contains('border-[var(--border-default)]')).toBe(false);
+ expect(
+ input.classList.contains(
+ 'border-[color-mix(in_srgb,var(--sidebar-item-active-foreground)_28%,transparent)]',
+ ),
+ ).toBe(true);
expect(button.classList.contains('text-sidebar-item-active-foreground')).toBe(true);
expect(button.classList.contains('hover:text-sidebar-item-active-foreground')).toBe(true);
});
+ it('clears a stale pointer-focus marker when the input blurs before pointerup', () => {
+ const onCommit = vi.fn();
+ const { container } = render(
+ createElement(SessionRenameInput, {
+ sessionId: 's1',
+ value: '旧标题',
+ onValueChange: () => {},
+ onCommit,
+ onCancel: () => {},
+ }),
+ );
+
+ const input = container.querySelector('input')!;
+ const button = container.querySelector('button')!;
+
+ // 指针在 input 按下后拖出,pointerup 不再落回 input;Tab 到 Magic 时的 blur
+ // 必须清掉该标记,Shift+Tab 回来仍应识别为键盘聚焦并显示蓝环。
+ fireEvent.pointerDown(input);
+ fireEvent.blur(input, { relatedTarget: button });
+ fireEvent.focus(button);
+ fireEvent.pointerUp(button);
+ fireEvent.blur(button, { relatedTarget: input });
+ fireEvent.focus(input);
+
+ expect(input.classList.contains('ring-2')).toBe(true);
+ expect(input.classList.contains('ring-[var(--focus-ring-soft)]')).toBe(true);
+ expect(onCommit).not.toHaveBeenCalled();
+ });
+
it('generated title fills the input without committing; Enter commits it', async () => {
const onCommit = vi.fn();
const { input, container } = await renderAndGenerate(onCommit, () => {});
diff --git a/apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx b/apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx
index 861c29affb..9fdcddcf89 100644
--- a/apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/SessionRenameInput.tsx
@@ -17,8 +17,9 @@
* 路由由 makerTransport.regenerateSessionTitleFor 决定;老被控端不识别该
* channel 时 invoke 被拒,走同一条失败 toast
*
- * 视觉:边框 / 圆角 / 透明底等共有部分内置;字号字重(各处不同)与布局定位
- * (flex-1 / 固定宽)分别由 inputClassName / containerClassName 传入。
+ * 视觉:中性胶囊描边 / 透明底 / 键盘聚焦环等共有部分内置;
+ * 字号字重(各处不同)与布局定位(flex-1 / 固定宽)分别由
+ * inputClassName / containerClassName 传入。
*/
import { useEffect, useRef, useState } from 'react';
@@ -67,7 +68,7 @@ interface SessionRenameInputProps {
inputClassName?: string;
/** 外层容器布局类:min-w-0 flex-1 或固定宽度。 */
containerClassName?: string;
- /** 位于侧栏 active 反相底色上时,input 与 Magic 按钮都切到配套前景色。 */
+ /** 位于侧栏 active 反相底色上时,input / 描边 / Magic 按钮都切到配套色系。 */
activeForeground?: boolean;
}
@@ -85,13 +86,22 @@ export function SessionRenameInput({
const inputRef = useRef<HTMLInputElement>(null);
const containerRef = useRef<HTMLDivElement>(null);
const [generating, setGenerating] = useState(false);
+ const [keyboardFocusVisible, setKeyboardFocusVisible] = useState(false);
+ // input 是程序化聚焦的文本控件,Chromium 会在鼠标双击进入编辑时也将它
+ // 匹配为 :focus-visible。记住首次聚焦与后续 pointer 聚焦,只在键盘路径上显示
+ // Focus Blue;鼠标进入编辑时只保留中性描边。
+ const applyingInitialFocusRef = useRef(true);
+ const pointerFocusRef = useRef(false);
// 卸载 = 编辑态已终结(提交/取消)。迟到的 AI 结果(成功或失败)据此丢弃:
// 不再填入输入框、不再 toast、不再 setState,避免污染用户的下一轮编辑。
const mountedRef = useRef(true);
useEffect(() => {
+ const origin = document.activeElement;
+ setKeyboardFocusVisible(origin instanceof HTMLElement && origin.matches(':focus-visible'));
inputRef.current?.focus();
inputRef.current?.select();
+ applyingInitialFocusRef.current = false;
return () => {
mountedRef.current = false;
};
@@ -168,6 +178,26 @@ export function SessionRenameInput({
ref={inputRef}
value={value}
onChange={(e) => onValueChange(e.target.value)}
+ onFocus={() => {
+ if (applyingInitialFocusRef.current) return;
+ setKeyboardFocusVisible(!pointerFocusRef.current);
+ }}
+ onBlur={() => {
+ // pointerup 可能落在 input 外(例如按下后拖出再松开),因此不能只靠
+ // onPointerUp / onPointerCancel 清理;否则后续 Shift+Tab 回来会被误判为鼠标聚焦。
+ pointerFocusRef.current = false;
+ setKeyboardFocusVisible(false);
+ }}
+ onPointerDown={() => {
+ pointerFocusRef.current = true;
+ setKeyboardFocusVisible(false);
+ }}
+ onPointerUp={() => {
+ pointerFocusRef.current = false;
+ }}
+ onPointerCancel={() => {
+ pointerFocusRef.current = false;
+ }}
onKeyDown={(e) => {
e.stopPropagation();
// IME 组合中的 Enter 是确认候选词,不是提交
@@ -186,10 +216,11 @@ export function SessionRenameInput({
// 吃掉浏览器默认的双击选词。stopPropagation 不影响默认选词行为。
onDoubleClick={(e) => e.stopPropagation()}
className={cn(
- 'w-full min-w-0 px-1.5 rounded',
- 'bg-transparent outline-none',
- 'border-[1.5px] border-[var(--focus-ring)]',
- 'pr-7',
+ 'w-full min-w-0 rounded-full border bg-transparent px-1.5 pr-7 outline-none',
+ activeForeground
+ ? 'border-[color-mix(in_srgb,var(--sidebar-item-active-foreground)_28%,transparent)]'
+ : 'border-[var(--border-default)]',
+ keyboardFocusVisible && 'ring-2 ring-[var(--focus-ring-soft)]',
inputClassName,
activeForeground && 'text-sidebar-item-active-foreground',
)}
@@ -209,7 +240,10 @@ export function SessionRenameInput({
e.preventDefault();
e.stopPropagation();
}}
- onPointerDown={(e) => e.stopPropagation()}
+ onPointerDown={(e) => {
+ setKeyboardFocusVisible(false);
+ e.stopPropagation();
+ }}
onDoubleClick={(e) => e.stopPropagation()}
onClick={(e) => {
e.stopPropagation();
@@ -221,7 +255,7 @@ export function SessionRenameInput({
activeForeground
? 'text-sidebar-item-active-foreground hover:text-sidebar-item-active-foreground hover:bg-[color-mix(in_srgb,var(--sidebar-item-active-foreground)_14%,transparent)]'
: 'text-[var(--cmd-palette-item-meta)] hover:bg-titlebar-button-hover hover:text-foreground',
- 'focus:outline-none',
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring-soft)]',
)}
>
{generating ? <Spinner size={13} /> : <Sparkles size={13} />}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
index f288783e86..d77abe32db 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
@@ -2,10 +2,9 @@
* SessionCard — sidebar-card-mode 下的单条会话卡片(SessionItem 的瀑布流形态)
* ---------------------------------------------------------------------------
* 设计来源:用户 Claude design 稿(XDT-sidebar-redesign,xdtsb-card 系)。
- * 视觉:白底 Card + 1px Board 圆角 12;标题左侧保留与 SessionItem 同源的
- * SessionStatusIcon(agent 标识 + running 呼吸 + attention 状态点 + 草稿铅笔),
- * 标题最多 2 行,摘要 / 最近消息随内容最多 1~3 行;底部 metadata 槽放短进度条、
- * worktree 标识和时间。
+ * 视觉:白底 Card + 1px Board 圆角 12;标题最多 2 行且保持纯文字,摘要 / 最近消息
+ * 随内容最多 1~3 行;SessionStatusIcon(agent 标识 + running 呼吸 + attention
+ * 状态点 + 草稿铅笔)、自动化 / 远程 / worktree 标识与时间统一放在底部 metadata 槽。
*
* 交互 100% 对齐 SessionItem(props 签名完全一致,sections 内按 cardMode 二选一渲染):
* - 单击导航 / 双击重命名(标题原位变 input)
@@ -13,8 +12,8 @@
* archived / draft 变体同款分支)
* - hover 右上角仅 More(⋮)快捷钮;存档收进 ⋮ / 右键展开菜单的 Archive 项
* (卡片不再出现独立的存档快捷钮)。已归档卡片保留"取消归档"快捷钮。
- * - card / list 变体:标题左侧复用 SessionStatusIcon(含 agent 图标、运行呼吸、草稿铅笔)
- * list 的状态点 / spinner 与文字模式同口径,统一放在右下角
+ * - list 变体保留标题左侧 SessionStatusIcon / 自动化前缀;card 变体标题不带前缀,
+ * 状态 / Agent / 自动化图标留在底部 meta 行
* - remote 会话标识复用 RemoteProjectIcon,继续区分 device-link / ssh
* - matchIndices 模糊搜索高亮沿用 highlightSegments
*
@@ -569,54 +568,59 @@ export function SessionCard({
/>
)}
<div className="flex items-center gap-1.5">
- {isEditing ? (
- <SessionRenameInput
- sessionId={session.id}
- value={editValue}
- onValueChange={setEditValue}
- onCommit={commitTitle}
- onCancel={() => {
- // Esc 取消视为终态:置 committedRef 拦掉 input 卸载触发的 blur 提交
- // 与生成中迟到的 AI 结果(Codex review P2:取消后不应再被 AI 改名)。
- committedRef.current = true;
- setIsEditing(false);
- }}
- containerClassName="min-w-0 flex-1"
- inputClassName="h-6 text-13 font-semibold text-foreground"
- activeForeground={isActive}
- />
- ) : (
- <div className="flex min-w-0 flex-1 items-center gap-1">
- <span
- className={cn(
- 'min-w-0 truncate',
- 'text-13 font-semibold leading-[1.3] tracking-[-0.005em]',
- isActive ? 'text-sidebar-item-active-foreground' : 'text-foreground',
+ {/* 标题槽固定沿用常态时间槽的 20px 高度。改名框本身是 24px,编辑时
+ 绝对定位居中覆盖文字槽位,不参与布局计算,避免整条置顶任务被撑高。
+ 状态 / Agent / 自动化图标始终留在文字槽左侧,编辑态也不改变标题起点。 */}
+ <div className="relative flex h-5 min-w-0 flex-1 items-center gap-0">
+ <span className="flex shrink-0 items-center">{titlePrefixNode}</span>
+ {isEditing ? (
+ <SessionRenameInput
+ sessionId={session.id}
+ value={editValue}
+ onValueChange={setEditValue}
+ onCommit={commitTitle}
+ onCancel={() => {
+ // Esc 取消视为终态:置 committedRef 拦掉 input 卸载触发的 blur 提交
+ // 与生成中迟到的 AI 结果(Codex review P2:取消后不应再被 AI 改名)。
+ committedRef.current = true;
+ setIsEditing(false);
+ }}
+ containerClassName="relative min-w-0 flex-1 self-stretch"
+ inputClassName="absolute inset-x-0 top-1/2 h-6 -translate-y-1/2 text-13 font-semibold text-foreground"
+ activeForeground={isActive}
+ />
+ ) : (
+ <div className="flex min-w-0 flex-1 items-center gap-1">
+ <span
+ className={cn(
+ 'min-w-0 truncate',
+ 'text-13 font-semibold leading-[1.3] tracking-[-0.005em]',
+ isActive ? 'text-sidebar-item-active-foreground' : 'text-foreground',
+ )}
+ >
+ {matchIndices && matchIndices.length > 0 && canHighlightDisplayTitle
+ ? highlightSegments(session.title, matchIndices, {
+ highlightClassName: cn(
+ 'bg-transparent font-semibold',
+ isActive
+ ? 'text-[var(--sidebar-item-active-foreground)]'
+ : 'text-[var(--msg-assistant-text)]',
+ ),
+ })
+ : displayTitle}
+ </span>
+ {remoteIconKind && (
+ <RemoteProjectIcon
+ kind={remoteIconKind}
+ size={11}
+ strokeWidth={1.8}
+ connectionStatus={remoteIconConnectionStatus}
+ className={isActive ? 'text-sidebar-item-active-foreground' : 'text-[var(--text-tertiary)]'}
+ />
)}
- >
- {titlePrefixNode}
- {matchIndices && matchIndices.length > 0 && canHighlightDisplayTitle
- ? highlightSegments(session.title, matchIndices, {
- highlightClassName: cn(
- 'bg-transparent font-semibold',
- isActive
- ? 'text-[var(--sidebar-item-active-foreground)]'
- : 'text-[var(--msg-assistant-text)]',
- ),
- })
- : displayTitle}
- </span>
- {remoteIconKind && (
- <RemoteProjectIcon
- kind={remoteIconKind}
- size={11}
- strokeWidth={1.8}
- connectionStatus={remoteIconConnectionStatus}
- className={isActive ? 'text-sidebar-item-active-foreground' : 'text-[var(--text-tertiary)]'}
- />
- )}
- </div>
- )}
+ </div>
+ )}
+ </div>
{/* 时间槽位:hover/菜单打开让位给 More/Archive(逻辑同对话列表)。
Agent 身份图标留在标题左侧,状态指示器改由下方右下角承担。 */}
@@ -732,41 +736,15 @@ export function SessionCard({
</button>
)}
- {/* 第 1 行:状态 / 自动化前缀在 list 与 card 变体共用同一段 titlePrefixNode,
- 保证 SessionStatusIcon、Timer 与标题在不同模式下的横向间距和基线一致。 */}
- {isEditing ? (
- <div className="flex items-start gap-1.5">
- <span className="mt-[2px] shrink-0">
- <SessionStatusIcon
- session={session}
- isRunning={isRunning}
- isAttached={isAttached}
- hasAttentionNotification={hasAttentionNotification}
- isActive={isActive}
- />
- </span>
- <SessionRenameInput
- sessionId={session.id}
- value={editValue}
- onValueChange={setEditValue}
- onCommit={commitTitle}
- onCancel={() => {
- // Esc 取消视为终态:置 committedRef 拦掉 input 卸载触发的 blur 提交
- // 与生成中迟到的 AI 结果(Codex review P2:取消后不应再被 AI 改名)。
- committedRef.current = true;
- setIsEditing(false);
- }}
- containerClassName="min-w-0 flex-1"
- inputClassName="h-6 text-[12.5px] font-bold text-foreground"
- activeForeground={isActive}
- />
- </div>
- ) : (
+ {/* 卡片标题始终保留原来的流式盒子;编辑时只把原标题隐藏,并以绝对定位的
+ 24px 输入框覆盖。这样一行 / 两行标题都维持原高度,也不会凭空多出状态图标。 */}
+ <div className="relative">
<div
className={cn(
'min-w-0 text-[12.5px] font-bold leading-[1.22] tracking-[-0.005em]',
'[display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden',
isActive ? 'text-sidebar-item-active-foreground' : 'text-foreground',
+ isEditing && 'invisible',
)}
style={{ textIndent: 0, paddingLeft: 0 }}
>
@@ -781,7 +759,24 @@ export function SessionCard({
})
: displayTitle}
</div>
- )}
+ {isEditing && (
+ <SessionRenameInput
+ sessionId={session.id}
+ value={editValue}
+ onValueChange={setEditValue}
+ onCommit={commitTitle}
+ onCancel={() => {
+ // Esc 取消视为终态:置 committedRef 拦掉 input 卸载触发的 blur 提交
+ // 与生成中迟到的 AI 结果(Codex review P2:取消后不应再被 AI 改名)。
+ committedRef.current = true;
+ setIsEditing(false);
+ }}
+ containerClassName="absolute inset-x-0 top-1/2 -translate-y-1/2"
+ inputClassName="h-6 text-[12.5px] font-bold text-foreground"
+ activeForeground={isActive}
+ />
+ )}
+ </div>
{/* 预览:等待交互文案优先,否则显示稳定任务总结 / 最近消息。图标全部下沉到底部 meta 行,
此处只放正文文字。 */}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
index c234244901..882df45d4a 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
@@ -342,11 +342,105 @@ describe('SessionCard visual cases', () => {
// list 变体保持原有标题前缀契约不变:自动化图标仍在标题里。
const { container: listContainer } = render(createElement(SessionCard, { ...commonProps, variant: 'list' }));
- const listTitle = Array.from(listContainer.querySelectorAll('span')).find((node) =>
- node.className.includes('truncate') && node.textContent?.includes('自动化日报巡检'),
+ const listTitleRow = Array.from(listContainer.querySelectorAll<HTMLElement>('div')).find(
+ (node) =>
+ node.classList.contains('h-5') &&
+ node.textContent?.includes('自动化日报巡检') &&
+ node.querySelector('[aria-label="查看自动化任务"]'),
);
- expect(listTitle?.textContent).toContain('自动化日报巡检');
- expect(listTitle?.querySelector('[aria-label="查看自动化任务"]')).not.toBeNull();
+ expect(listTitleRow?.textContent).toContain('自动化日报巡检');
+ expect(listTitleRow?.querySelector('[aria-label="查看自动化任务"]')).not.toBeNull();
+ });
+
+ it('keeps the list title row height stable while the rename editor overlays it', () => {
+ const visualCase = sessionCardVisualCases.find((item) => item.id === 'short-idle-cc');
+ if (!visualCase) throw new Error('Missing idle visual case');
+
+ const { container } = render(
+ createElement(SessionCard, {
+ session: visualCase.session,
+ variant: 'list',
+ isActive: false,
+ isRunning: false,
+ isAttached: false,
+ hasAttentionNotification: false,
+ isSelected: false,
+ onClick: vi.fn(),
+ onAction: vi.fn(),
+ onRename: vi.fn(),
+ onTogglePin: vi.fn(),
+ projectOptions: [],
+ }),
+ );
+
+ const card = container.querySelector<HTMLElement>('[data-sidebar-session-row="true"]')!;
+ const titleRow = Array.from(card.querySelectorAll<HTMLElement>('div')).find(
+ (node) =>
+ node.classList.contains('h-5') && node.textContent?.includes(visualCase.session.title),
+ );
+ expect(titleRow).toBeTruthy();
+ const statusIconSlot = Array.from(titleRow!.querySelectorAll<HTMLElement>('span')).find(
+ (node) => node.className.includes('w-3') && node.querySelector('svg'),
+ );
+ expect(statusIconSlot).toBeTruthy();
+
+ fireEvent.doubleClick(card);
+
+ const input = card.querySelector<HTMLInputElement>('input')!;
+ const editor = input.parentElement!;
+ expect(editor.parentElement).toBe(titleRow);
+ expect(editor.classList.contains('relative')).toBe(true);
+ expect(editor.classList.contains('self-stretch')).toBe(true);
+ expect(input.classList.contains('absolute')).toBe(true);
+ expect(input.classList.contains('inset-x-0')).toBe(true);
+ expect(input.classList.contains('top-1/2')).toBe(true);
+ expect(input.classList.contains('-translate-y-1/2')).toBe(true);
+ expect(input.classList.contains('h-6')).toBe(true);
+ expect(titleRow!.contains(statusIconSlot!)).toBe(true);
+ });
+
+ it('keeps the card title flow box mounted while the rename editor overlays it without a duplicate status icon', () => {
+ const visualCase = sessionCardVisualCases.find((item) => item.id === 'short-idle-cc');
+ if (!visualCase) throw new Error('Missing idle visual case');
+
+ const { container } = render(
+ createElement(SessionCard, {
+ session: visualCase.session,
+ isActive: false,
+ isRunning: false,
+ isAttached: false,
+ hasAttentionNotification: false,
+ isSelected: false,
+ onClick: vi.fn(),
+ onAction: vi.fn(),
+ onRename: vi.fn(),
+ onTogglePin: vi.fn(),
+ projectOptions: [],
+ }),
+ );
+
+ const card = container.querySelector<HTMLElement>('[data-sidebar-session-row="true"]')!;
+ const title = Array.from(card.querySelectorAll<HTMLElement>('div')).find((node) =>
+ node.className.includes('[-webkit-line-clamp:2]'),
+ )!;
+ expect(title.classList.contains('invisible')).toBe(false);
+
+ fireEvent.doubleClick(card);
+
+ const input = card.querySelector<HTMLInputElement>('input')!;
+ const overlay = input.parentElement!;
+ const titleSlot = title.parentElement!;
+ expect(card.contains(title)).toBe(true);
+ expect(title.classList.contains('invisible')).toBe(true);
+ expect(titleSlot).toBe(overlay.parentElement);
+ expect(titleSlot.classList.contains('relative')).toBe(true);
+ expect(overlay.classList.contains('absolute')).toBe(true);
+ expect(overlay.classList.contains('inset-x-0')).toBe(true);
+ expect(overlay.classList.contains('top-1/2')).toBe(true);
+ expect(overlay.classList.contains('-translate-y-1/2')).toBe(true);
+ expect(titleSlot.querySelectorAll('svg')).toHaveLength(1);
+ expect(titleSlot.querySelector('.lucide-sparkles')).not.toBeNull();
+ expect(input.classList.contains('h-6')).toBe(true);
});
it('keeps archived sessions on the archive visual branch', () => {