feat(ui): 保时捷语法复刻收尾(ADR-0008/0009/0011/0012/0013) #65
No files matched your search
@@ -151,4 +151,20 @@ describe('内容列表页:搜索请求节流', () => {
|
||||
expect(screen.getByText('新查询结果')).toBeInTheDocument();
|
||||
expect(screen.queryByText('慢查询结果')).toBeNull();
|
||||
});
|
||||
|
||||
// ── DEF-04:390 档表格必须能横向滚动,而不是把 7 列挤成一条 ──
|
||||
it('表格带最小宽度并被 overflow-x-auto 容器包住(390 档可横滚)', async () => {
|
||||
nav.state.params = { modelCode: 'news' };
|
||||
api.getItems.mockResolvedValue(rowsResult([row('一条内容')]));
|
||||
const { container } = render(<ContentListPage />);
|
||||
await waitFor(() => expect(screen.getByText('一条内容')).toBeInTheDocument());
|
||||
|
||||
const table = container.querySelector('table');
|
||||
expect(table).not.toBeNull();
|
||||
// 固定版式宽:列宽由 white-space:nowrap 撑开,容器才有东西可滚
|
||||
expect(table!.className).toContain('min-w-[760px]');
|
||||
// 外层必须真的允许横向滚动,否则 min-w 只是把内容溢出成裁剪
|
||||
const scroller = table!.parentElement;
|
||||
expect(scroller!.className).toContain('overflow-x-auto');
|
||||
});
|
||||
});
|
||||
@@ -177,14 +177,14 @@ export default function ContentListPage() {
|
||||
{/* Table */}
|
||||
<div className="bg-bg-primary rounded-lg border border-border-primary overflow-hidden">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full">
|
||||
<table className="w-full min-w-[760px]">
|
||||
<thead>
|
||||
<tr className="border-b border-border-primary bg-bg-secondary">
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase">标题</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase">Slug</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase">状态</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase">更新时间</th>
|
||||
<th className="text-right px-4 py-3 text-xs font-medium text-text-muted uppercase">操作</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase whitespace-nowrap">标题</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase whitespace-nowrap">Slug</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase whitespace-nowrap">状态</th>
|
||||
<th className="text-left px-4 py-3 text-xs font-medium text-text-muted uppercase whitespace-nowrap">更新时间</th>
|
||||
<th className="text-right px-4 py-3 text-xs font-medium text-text-muted uppercase whitespace-nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-border-light">
|
||||
@@ -205,15 +205,15 @@ export default function ContentListPage() {
|
||||
) : (
|
||||
items.map((item) => (
|
||||
<tr key={item.id} className="hover:bg-bg-secondary transition-colors">
|
||||
<td className="px-4 py-3">
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
<span className="text-sm font-medium text-text-primary">{item.title}</span>
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
<code className="text-xs text-text-muted bg-bg-hover px-1.5 py-0.5 rounded">
|
||||
{item.slug || '-'}
|
||||
</code>
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
<span
|
||||
className={`inline-flex text-xs px-2 py-0.5 rounded-full font-medium ${
|
||||
item.status === 'published'
|
||||
@@ -226,7 +226,7 @@ export default function ContentListPage() {
|
||||
{STATUS_LABELS[item.status] || item.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm text-text-muted">
|
||||
<td className="px-4 py-3 text-sm text-text-muted whitespace-nowrap">
|
||||
{item.updatedAt ? new Date(item.updatedAt).toLocaleDateString('zh-CN') : '-'}
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
|
||||
@@ -287,16 +287,16 @@ export default function UsersPage() {
|
||||
{/* Users table */}
|
||||
<div className="bg-bg-primary rounded-lg border border-border-primary overflow-hidden">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<table className="w-full min-w-[760px] text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border-primary bg-bg-secondary">
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">用户名</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">昵称</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">邮箱</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">角色</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">状态</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary">创建时间</th>
|
||||
<th className="text-right px-4 py-3 font-medium text-text-tertiary">操作</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">用户名</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">昵称</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">邮箱</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">角色</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">状态</th>
|
||||
<th className="text-left px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">创建时间</th>
|
||||
<th className="text-right px-4 py-3 font-medium text-text-tertiary whitespace-nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -318,14 +318,14 @@ export default function UsersPage() {
|
||||
) : (
|
||||
users.map((u) => (
|
||||
<tr key={u.id} className="border-b border-border-light hover:bg-bg-secondary">
|
||||
<td className="px-4 py-3">
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
<div className="flex items-center gap-2">
|
||||
<UserCog className="w-4 h-4 text-text-muted" />
|
||||
<span className="font-medium text-text-primary">{u.username}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-text-tertiary">{u.nickname || '-'}</td>
|
||||
<td className="px-4 py-3">
|
||||
<td className="px-4 py-3 text-text-tertiary whitespace-nowrap">{u.nickname || '-'}</td>
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
{u.email ? (
|
||||
<a href={`mailto:${u.email}`} className="text-text-tertiary hover:text-text-primary flex items-center gap-1">
|
||||
<Mail className="w-3 h-3" />
|
||||
|
||||
Reference in new issue
Block a user