feat: 完成工作流多文件文档解析闭环
- 支持文档解析节点批量解析并收口为 documents 轻量输出 - 收口引用树、节点输出展示与旧工作流固定输出兼容 - 修复共享按钮点击事件,恢复多个节点加号交互
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user