feat: 完成工作流多文件文档解析闭环

- 支持文档解析节点批量解析并收口为 documents 轻量输出

- 收口引用树、节点输出展示与旧工作流固定输出兼容

- 修复共享按钮点击事件,恢复多个节点加号交互
This commit is contained in:
2026-04-19 16:05:40 +08:00
parent a5aab86de2
commit 1d8b9d9662
15 changed files with 496 additions and 48 deletions

View File

@@ -0,0 +1,53 @@
import { flushSync, mount, unmount } from 'svelte';
import { afterEach, describe, expect, it, vi } from 'vitest';
import Button from './button.svelte';
import MenuButton from './menu-button.svelte';
describe('Button', () => {
afterEach(() => {
document.body.innerHTML = '';
});
it('转发 onclick 到原生按钮', async () => {
const handleClick = vi.fn();
const host = document.createElement('div');
document.body.appendChild(host);
const app = mount(Button, {
target: host,
props: {
onclick: handleClick,
},
});
flushSync();
(host.querySelector('button') as HTMLButtonElement).click();
expect(handleClick).toHaveBeenCalledTimes(1);
await unmount(app);
host.remove();
});
it('通过 MenuButton 转发 onclick 到原生按钮', async () => {
const handleClick = vi.fn();
const host = document.createElement('div');
document.body.appendChild(host);
const app = mount(MenuButton, {
target: host,
props: {
onclick: handleClick,
},
});
flushSync();
(host.querySelector('button') as HTMLButtonElement).click();
expect(handleClick).toHaveBeenCalledTimes(1);
await unmount(app);
host.remove();
});
});