✨ feat(vscode): 代码阅读侧栏行加复制菜单,块按钮只留图标,筛选菜单加全选 / 取消全选

This commit is contained in:
cruldra committed 2026-09-26 20:39:21 +08:00
1 parent 631699a570
commit c84e21ff57
16 files changed
+555 -119

No files matched your search

@@ -0,0 +1,20 @@
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it } from 'vitest'
import { BlockTools } from './BlockTools'
const render = (editing: boolean): string => renderToStaticMarkup(<BlockTools editing={editing} onToggleEdit={() => {}} />)
/** 标签之间的字:图标(svg)没有字,按钮上有字就会出现在这里 */
const visibleText = (html: string): string => html.replace(/<[^>]*>/g, '').trim()
describe('块右上角的图标按钮', () => {
it.each([[false, '编辑'], [true, '预览']] as const)('编辑中 = %s:只有图标不带字,名字在悬停提示和 aria-label 里', (editing, label) => {
const html = render(editing)
expect(html).toMatch(/^<div[^>]* role="group" aria-label="块操作"/)
expect(visibleText(html)).toBe('')
expect(html.match(/<button/g)).toHaveLength(1)
expect(html).toContain(`title="${label}" aria-label="${label}"`)
expect(html).toMatch(/<button[^>]*><svg/)
expect(html.includes('data-active')).toBe(editing)
})
})