feat(web): unify vehicle evidence workspace

This commit is contained in:
lingniu
2026-07-20 04:56:27 +08:00
parent 952f886459
commit 9eb77a2d57
6 changed files with 80 additions and 17 deletions

View File

@@ -46,7 +46,7 @@ afterEach(() => {
vi.mocked(useMobileLayout).mockReturnValue(false);
});
test('loads all source evidence only after the user expands it', async () => {
test('loads all source evidence in a Semi right SideSheet without reflowing the desktop record', async () => {
const sourceEvidence = vi.spyOn(api, 'vehicleSourceEvidence').mockResolvedValue(evidence);
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
@@ -57,10 +57,16 @@ test('loads all source evidence only after the user expands it', async () => {
fireEvent.click(screen.getByRole('button', { name: '查看全部来源' }));
await waitFor(() => expect(sourceEvidence).toHaveBeenCalledTimes(1));
expect(await screen.findByText('北斗平台')).toBeInTheDocument();
expect(view.container.querySelectorAll('.v2-source-evidence-card.semi-card')).toHaveLength(3);
expect(view.container.querySelector('.v2-source-evidence > .semi-card-body > .v2-source-evidence-body')).not.toBeInTheDocument();
expect(document.querySelector('.v2-source-evidence-sidesheet')).toHaveClass('v2-workspace-detail-sidesheet');
expect(document.querySelector('.v2-source-evidence-sidesheet .semi-sidesheet-inner')).toHaveStyle({ width: 'min(680px, calc(100vw - 24px))' });
expect(document.querySelectorAll('.v2-source-evidence-sidesheet .v2-source-evidence-card.semi-card')).toHaveLength(3);
expect(screen.getAllByText('当前推荐').every((item) => item.closest('.semi-tag'))).toBe(true);
expect(screen.getAllByText('当前推荐').length).toBeGreaterThan(0);
expect(screen.queryByText('13307795425')).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '关闭来源证据' }));
await waitFor(() => expect(view.container.querySelector('.v2-source-evidence')).not.toHaveClass('is-open'));
client.clear();
});