fix: align report workbench page actions
This commit is contained in:
@@ -3,6 +3,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { AdminReportBatchesPage } from './AdminReportBatchesPage';
|
||||
import { AdminReportMaterialsPage } from './AdminReportMaterialsPage';
|
||||
import { AdminReportTasksPage } from './AdminReportTasksPage';
|
||||
|
||||
const { adminApi, clipboardWriteText } = vi.hoisted(() => ({
|
||||
@@ -11,9 +12,11 @@ const { adminApi, clipboardWriteText } = vi.hoisted(() => ({
|
||||
exportSingleReportMaterial: vi.fn(),
|
||||
getReportMaterialBatch: vi.fn(),
|
||||
getSingleReportMaterialDetail: vi.fn(),
|
||||
listPendingReportMaterials: vi.fn(),
|
||||
listReportDetailsPage: vi.fn(),
|
||||
listReportMaterialBatches: vi.fn(),
|
||||
listReportMaterialBatchTasks: vi.fn(),
|
||||
preflightReportMaterialBatch: vi.fn(),
|
||||
},
|
||||
clipboardWriteText: vi.fn(),
|
||||
}));
|
||||
@@ -54,7 +57,7 @@ describe('report workbench pages', () => {
|
||||
);
|
||||
|
||||
const user = userEvent.setup();
|
||||
const selectPage = await screen.findByRole('button', { name: '全选当前页' });
|
||||
const selectPage = await screen.findByRole('button', { name: '全选当页' });
|
||||
await user.click(selectPage);
|
||||
expect(screen.getByRole('button', { name: '取消全选' })).toBeVisible();
|
||||
expect(screen.getByRole('button', { name: '批量修改状态(2)' })).toBeEnabled();
|
||||
@@ -65,6 +68,49 @@ describe('report workbench pages', () => {
|
||||
screen.getAllByRole('checkbox').forEach((checkbox) => expect(checkbox).not.toBeChecked());
|
||||
});
|
||||
|
||||
it('uses the shared current-page selection button in the material pool heading', async () => {
|
||||
const material = {
|
||||
id: 'signature:signature-1',
|
||||
tenantId: 'tenant-1',
|
||||
signatureId: 'signature-1',
|
||||
applicationId: 'app-1',
|
||||
reportType: 'signature',
|
||||
name: '测试签名',
|
||||
detail: '测试用途',
|
||||
materialVersion: 1,
|
||||
changedAt: '2026-09-03T01:00:00.000Z',
|
||||
tenant: { id: 'tenant-1', name: '测试企业' },
|
||||
application: { id: 'app-1', name: '测试应用' },
|
||||
};
|
||||
adminApi.listPendingReportMaterials.mockResolvedValue({ items: [material], total: 1, page: 1, pageSize: 20 });
|
||||
adminApi.preflightReportMaterialBatch.mockResolvedValue({
|
||||
eligible: true,
|
||||
eligibleTargetCount: 1,
|
||||
skippedTargetCount: 0,
|
||||
items: [
|
||||
{
|
||||
id: material.id,
|
||||
eligible: true,
|
||||
blockedReasons: [],
|
||||
targets: [{ eligible: true }],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<AdminReportMaterialsPage />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
const user = userEvent.setup();
|
||||
await user.click(await screen.findByRole('button', { name: '全选当页' }));
|
||||
expect(screen.getByRole('button', { name: '取消全选' })).toBeVisible();
|
||||
expect(screen.getByRole('button', { name: '预检并生成(1)' })).toBeEnabled();
|
||||
expect(screen.getByRole('checkbox', { name: '选择测试签名' })).toBeChecked();
|
||||
expect(screen.queryByText('选择本页全部可生成资料')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows and copies the channel brief returned by the batch detail API', async () => {
|
||||
const batch = {
|
||||
id: 'batch-1',
|
||||
|
||||
Reference in New Issue
Block a user