Archived
feat(ops): 运营中心 · 活动模块接口落地 —— L1/L2/L3 十一条(全 ops)+ 设计端活动库两条改名让位
`apps/api/src/app/activity-ops/*`(service / store / instance-state / instance-steps / launch-params / summaries / view-html / view-scope)+ `routes/activities.ts`;契约 `activity-ops.ts` / `api/activity-ops.ts` (与队友按文档补的那版 43 个导出同名,多 INSTANCE_REASON_KINDS / STEP_RESULTS / launchOptionSchema); 迁移 0035_activity_ops;《API文档-活动模块》按契约回写。 设计端活动库 GET/POST `/api/gov/activities` 改名 `/api/gov/activity-packages`,`/api/gov/activities/*` 整个让给运营端(前端 import 路由对象,零改动);activity-registry CONTRACT.md 与路由总表同步。 2026-08-27 另一会话做的,一直留在工作树没入库;与同批另两条提交互相依赖,以合并提交为验证单位。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167qWjeyBwvfdGovd7FWbCu
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/** 沙箱视图出口:模版原文不改,只在 </body> 前注入报高脚本 */
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { ACTIVITY_VIEW_HEIGHT_MESSAGE } from '@contracts';
|
||||
import { injectHeightScript } from '../activity-ops/view-html.ts';
|
||||
|
||||
describe('injectHeightScript', () => {
|
||||
it('插在 </body> 之前;没有 body 就追加;原文一字不改', () => {
|
||||
const html = '<!doctype html><html><body><h1>一览</h1></body></html>';
|
||||
const out = injectHeightScript(html);
|
||||
expect(out.startsWith('<!doctype html><html><body><h1>一览</h1>')).toBe(true);
|
||||
expect(out.indexOf('<script>')).toBeLessThan(out.indexOf('</body>'));
|
||||
expect(out).toContain(ACTIVITY_VIEW_HEIGHT_MESSAGE);
|
||||
expect(out).toContain("postMessage({type:T,height:h()},'*')");
|
||||
const bare = injectHeightScript('<p>x</p>');
|
||||
expect(bare.startsWith('<p>x</p>')).toBe(true);
|
||||
expect(bare).toContain('<script>');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user