feat(conversation): replicate table quote-to-chat action (TODO 02)

This commit is contained in:
xiaohan.yuan committed 2026-10-17 05:57:49 +08:00
1 parent e335588826
commit ed31a7c1b4
20 files changed
+939 -46

No files matched your search

+5 -3
View File
@@ -31,9 +31,11 @@ async function main(): Promise<void> {
assert.doesNotMatch(render('before<script>window.bad = true</script>after'), /<script|window\.bad/)
assert.match(render('Waiting $x +', true), /markdown-content__loading-char/)
const table = '| a | b |\n| - | - |\n| 1 | 2 |'
const tableWithAction = (streaming: boolean): string => renderToStaticMarkup(<MarkdownContent content={table} streaming={streaming} onQuote={() => undefined} />)
assert.match(tableWithAction(true), /class="markdown-content__table-quote" disabled=""/)
assert.doesNotMatch(tableWithAction(false), /class="markdown-content__table-quote" disabled/)
const tableWithAction = (streaming: boolean): string => renderToStaticMarkup(<MarkdownContent content={table} messageId="fixture-message" sourceId="fixture-message-text-0" streaming={streaming} onQuote={() => undefined} />)
assert.match(tableWithAction(true), /class="cr-message-quote-table-action" disabled=""[^>]*aria-label="添加到对话"/)
assert.match(tableWithAction(false), /class="cr-message-quote-table-action"[^>]*aria-label="添加到对话">/)
assert.doesNotMatch(tableWithAction(false), /class="cr-message-quote-table-action" disabled/)
assert.match(tableWithAction(false), /data-message-quote-source-id="fixture-message-text-0:table:table-0"/)
const opacity = render('abcdef', true)
assert.match(opacity, /style="opacity:0\.6/)
assert.match(opacity, /style="opacity:0\.1/)