展开态补回空态提示:复用栏目页同一个 .game-resource-page-empty 与文案,不新增样式
Project CI / Repository checks (pull_request) Failing after 1m18s
Project CI / Frontend tests (pull_request) Successful in 3m29s
Project CI / Backend tests (pull_request) Successful in 6m42s
Project CI / Native shell tests (pull_request) Successful in 17m44s

- 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:
2026-09-11 23:55:36 +08:00
parent 85358b2ca5
commit f11942f357
2 changed files with 28 additions and 0 deletions
@@ -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('没有匹配资源');
});
/**