feat: 0.9.3 单文件视图文本搜索与稳健性收尾 - 工具栏搜索框(Ctrl+F聚焦/大小写不敏感即时命中计数/Enter与Shift+Enter命中行循环跳转复用activeRowId受控定位/行内命中子串高亮含词级segs行/Esc清空;基于全量行与仅看差异独立、折叠命中行跳转toast提示不推进)、扫描缓存落盘promise链串行化(并发读改写不再覆盖丢LRU目录对)、快照对照变迁过滤计数归零自动复位、重新选择扫描中保持可用固化测试(与返回文件对比同类发起新会话作废在途扫描)、依赖patch级升级,新增21单测用例与E2E搜索链路用例(564单测+E2E 24全过,覆盖率98.27/93.47/94.01/98.27),文档四件套同步
This commit is contained in:
@@ -197,6 +197,30 @@ test.describe('差异导航与视图', () => {
|
||||
await app.close()
|
||||
})
|
||||
|
||||
test('单文件视图搜索:Ctrl+F 聚焦、计数跳转、行内高亮与 Esc 清空(0.9.3)', async () => {
|
||||
const { app, window } = await launchApp()
|
||||
await pasteText(window, 'left', 'alpha\nfind target one\ngamma\nfind target two')
|
||||
await pasteText(window, 'right', 'alpha\nfind target one\ngamma\nfind target two')
|
||||
await expect(window.getByText('两文件内容完全一致')).toBeVisible()
|
||||
// Ctrl+F 聚焦搜索框
|
||||
await window.keyboard.press('Control+f')
|
||||
const input = window.getByPlaceholder('搜索内容… (Ctrl+F)')
|
||||
await expect(input).toBeFocused()
|
||||
// 输入关键字:即时计数与行内命中高亮
|
||||
await input.fill('target')
|
||||
await expect(window.locator('.search-count')).toHaveText('1 / 2')
|
||||
await expect(window.locator('.search-hit').first()).toBeVisible()
|
||||
// Enter 跳转下一个命中行(第一个命中行 active 定位)
|
||||
await window.keyboard.press('Enter')
|
||||
await expect(window.locator('.search-count')).toHaveText('2 / 2')
|
||||
await expect(window.locator('.diff-row.active .ln').first()).toHaveText('4')
|
||||
// Esc 清空关键字(计数复位消失)
|
||||
await window.keyboard.press('Escape')
|
||||
await expect(input).toHaveValue('')
|
||||
await expect(window.locator('.search-count')).toHaveText('')
|
||||
await app.close()
|
||||
})
|
||||
|
||||
test('交换左右侧后面板文件互换', async () => {
|
||||
const dir = await makeTmpDir('difflens-e2e-swap-')
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user