Improve conversation preview layout

This commit is contained in:
Codex
2026-08-23 20:09:56 +08:00
parent 3bcf4458c5
commit a34cab431a
2 changed files with 28 additions and 8 deletions
@@ -18,6 +18,12 @@ function functionSource(source, name, nextName) {
return source.slice(start, end);
}
function cssBlock(source, selector) {
const match = source.match(new RegExp(`${selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*\\{[^}]*\\}`));
assert.ok(match, `${selector} style block should exist`);
return match[0];
}
test('无项目文件夹与普通项目共用悬浮和键盘聚焦预览', () => {
const source = functionSource(projects, 'appendChatProjectFolderItem', 'appendChatProjectConversationItem');
@@ -122,3 +128,13 @@ test('对话悬浮预览显示本地年月日时分', () => {
assert.match(zh, /"conversationPreviewDateTime": "\{\{year\}\}年\{\{month\}\}月\{\{day\}\}日 \{\{hour\}\}:\{\{minute\}\}"/);
assert.match(en, /"conversationPreviewDateTime": "\{\{year\}\}-\{\{month\}\}-\{\{day\}\} \{\{hour\}\}:\{\{minute\}\}"/);
});
test('对话悬浮预览标题与时间分行显示并保留更多标题内容', () => {
const titleStyles = cssBlock(styles, '.project-conversation-preview-title');
assert.match(styles, /\.conversation-sidebar\s*\{[\s\S]*?width: 320px;/);
assert.match(styles, /\.project-conversation-preview\s*\{[\s\S]*?width: min\(340px, calc\(100vw - 32px\)\);/);
assert.match(styles, /\.project-conversation-preview-header\s*\{[\s\S]*?flex-direction: column;[\s\S]*?align-items: flex-start;/);
assert.match(titleStyles, /-webkit-line-clamp: 2;/);
assert.doesNotMatch(titleStyles, /white-space: nowrap;/);
});