429f991bde
Project CI / AI game creator shell Rust shard 2/4 (push) Failing after 19s
Project CI / AI game creator shell Rust shard 3/4 (push) Failing after 20s
Project CI / AI game creator shell Rust shard 1/4 (push) Failing after 20s
Project CI / AI game creator shell Rust shard 4/4 (push) Failing after 20s
Project CI / Backend tests (push) Failing after 17s
Project CI / AI game creator shell Rust crates (push) Failing after 17s
Project CI / AI game creator shell Rust smoke (push) Failing after 19s
Project CI / Native shell tests (push) Failing after 18s
Project CI / Frontend tests (push) Failing after 8s
Project CI / AI game creator shell web tests (push) Failing after 15s
Project CI / Repository checks (push) Failing after 17s
- 撤销 39aed2e48 夹带的游戏分发前后端、SpacetimeDB 绑定、主站路由、后台审核页、文档与 nginx 改动,master 恢复可编译状态
- 保留该提交自身的 AGC 发号改动:agc-global-version.mjs 与其参数构造单测
- 恢复被误删的 output 产物,避免把无关清理混进该提交
- 补回两篇技术文档在 docs/README.md 的索引(它们属于后续两个补提交文档,不属于游戏分发)
- 游戏分发完整实现保留在 codex/game-distribution 分支继续开发
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
|
|
import {
|
|
APP_HOME_TITLE,
|
|
resolveAppTitleForSelectionStage,
|
|
syncAppTitle,
|
|
} from './activeAppTitle';
|
|
|
|
const hostBridgeMock = vi.hoisted(() => ({
|
|
setHostAppTitle: vi.fn(),
|
|
}));
|
|
|
|
vi.mock('./host-bridge/hostBridge', () => ({
|
|
setHostAppTitle: hostBridgeMock.setHostAppTitle,
|
|
}));
|
|
|
|
afterEach(() => {
|
|
document.title = '';
|
|
hostBridgeMock.setHostAppTitle.mockReset();
|
|
});
|
|
|
|
describe('activeAppTitle', () => {
|
|
test('maps only active platform stages', () => {
|
|
expect(resolveAppTitleForSelectionStage('platform')).toBe(APP_HOME_TITLE);
|
|
expect(resolveAppTitleForSelectionStage('creation-home')).toBe(
|
|
APP_HOME_TITLE,
|
|
);
|
|
expect(resolveAppTitleForSelectionStage('project')).toBe('项目 - 陶泥儿');
|
|
expect(resolveAppTitleForSelectionStage('profile')).toBe('我的 - 陶泥儿');
|
|
expect(resolveAppTitleForSelectionStage('image-editor')).toBe(
|
|
'美术编辑器 - 陶泥儿',
|
|
);
|
|
});
|
|
|
|
test('syncs browser and host titles', () => {
|
|
syncAppTitle(' 项目 - 陶泥儿 ');
|
|
|
|
expect(document.title).toBe('项目 - 陶泥儿');
|
|
expect(hostBridgeMock.setHostAppTitle).toHaveBeenCalledWith({
|
|
title: '项目 - 陶泥儿',
|
|
});
|
|
});
|
|
|
|
test('falls back to the brand for an empty title', () => {
|
|
syncAppTitle(' ');
|
|
|
|
expect(document.title).toBe('陶泥儿');
|
|
expect(hostBridgeMock.setHostAppTitle).toHaveBeenCalledWith({
|
|
title: '陶泥儿',
|
|
});
|
|
});
|
|
});
|