展开态补回空态提示:复用栏目页同一个 .game-resource-page-empty 与文案,不新增样式
- index.tsx:展开态在"可见资源为 0"时渲染 <p class="game-resource-page-empty">没有匹配资源</p>,与栏目页那一条同一条判据口径与同一句文案 - 它挂在既有的画布浮层 host 下(该 host 自身不定位),因此按画本场景根居中,观感与栏目页一致,不需要任何新 CSS - 测试:空项目的「所有资源」用例补三条断言——进入展开态后标题栏是 .is-active[data-resource-book-category="all"]、卡片宿主数为 0、空态文案是「没有匹配资源」(把"复用既有空态、不新增样式"变成可执行判据)
This commit is contained in:
@@ -6263,6 +6263,17 @@ export default function ProjectDevelopmentView({
|
||||
overlay={
|
||||
resourceBookView === 'main' ? null : (
|
||||
<div className="game-resource-canvas-toolbar-host">
|
||||
{/*
|
||||
展开态的空态:复用栏目页同一个类与同一句文案(不新增样式)。
|
||||
`.game-resource-page-empty` 是 `absolute + inset: 0 + place-items: center`,
|
||||
而这条 host 自身不定位,所以它会按场景根居中,和栏目页那条判定同一观感。
|
||||
*/}
|
||||
{resourceBookOpensAllResources &&
|
||||
visibleResources.length === 0 ? (
|
||||
<p className="game-resource-page-empty">
|
||||
没有匹配资源
|
||||
</p>
|
||||
) : null}
|
||||
{selectedResourceLayer &&
|
||||
selectedToolbarStyle &&
|
||||
((selectedToolbarActions?.size ?? 0) > 0 ||
|
||||
|
||||
@@ -9771,6 +9771,23 @@ export function registerProjectAgentStatusTests() {
|
||||
'.game-resource-book-scene-titlebar[data-resource-book-category="all"] .game-resource-book-titlebar-meta small',
|
||||
)?.textContent,
|
||||
).toBe('0 项');
|
||||
|
||||
// 空项目进展开态也不破版:一张卡都不挂,空态复用栏目页同一个类与同一句文案
|
||||
// (「不新增样式」这条红线的可执行判据)。
|
||||
fireEvent.click(screen.getByRole('button', { name: '打开所有资源' }));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
document.querySelector(
|
||||
'.game-resource-book-scene-titlebar.is-active[data-resource-book-category="all"]',
|
||||
),
|
||||
).not.toBeNull(),
|
||||
);
|
||||
expect(
|
||||
document.querySelectorAll('.game-resource-book-scene-card'),
|
||||
).toHaveLength(0);
|
||||
expect(
|
||||
document.querySelector('.game-resource-page-empty')?.textContent,
|
||||
).toBe('没有匹配资源');
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user