refine Semi UI platform shell and states

This commit is contained in:
lingniu
2026-07-18 01:12:48 +08:00
parent 1cd92715a5
commit 5c0a61f7bd
9 changed files with 1298 additions and 54 deletions

View File

@@ -19,6 +19,8 @@ describe('route recovery boundary', () => {
render(<PlatformErrorBoundary><BrokenShell /></PlatformErrorBoundary>);
expect(screen.getByRole('alert')).toHaveTextContent('平台外壳运行异常');
expect(document.querySelector('.v2-route-error-card.semi-card')).toBeInTheDocument();
expect(screen.getByText('查看技术信息')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /重新加载平台/ })).toHaveClass('semi-button');
expect(screen.getByRole('button', { name: /返回全局监控/ })).toHaveClass('semi-button');
});
@@ -35,6 +37,7 @@ describe('route recovery boundary', () => {
const BrokenPage = () => { throw new Error('render exploded'); };
render(<MemoryRouter future={ROUTER_FUTURE} initialEntries={['/history']}><RoutePage page={BrokenPage} label="历史数据" /></MemoryRouter>);
expect(screen.getByRole('alert')).toHaveTextContent('当前模块暂时无法显示');
expect(document.querySelector('.v2-route-error.is-runtime .v2-route-error-card.semi-card')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /刷新当前页面/ })).toHaveClass('semi-button');
expect(screen.getByRole('button', { name: /返回全局监控/ })).toHaveClass('semi-button');
});
@@ -83,7 +86,7 @@ describe('route recovery boundary', () => {
const PendingPage = lazy(() => new Promise<never>(() => undefined));
const { container } = render(<MemoryRouter future={ROUTER_FUTURE} initialEntries={['/access']}><RoutePage page={PendingPage} label="接入管理" /></MemoryRouter>);
expect(screen.getByRole('status')).toHaveTextContent('正在加载接入管理');
expect(screen.getByText('导航与筛选状态已保留')).toBeInTheDocument();
expect(screen.getByText(/导航与筛选状态已保留/)).toBeInTheDocument();
expect(container.querySelectorAll('.v2-page-skeleton > i')).toHaveLength(4);
});