From cad7b02266c6fc582f4ea70422f0128fd0178f02 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Fri, 18 Sep 2026 10:36:17 +0800 Subject: feat(frontend): 回测结果页与对比表接入投入口径一行三项 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [变更性质] 页面集成,任务 A1/A2 前端口径统一。 [新增功能] 结果页 metric 区新增累计投入/最终持仓估值/投入回报率三卡(data-testid=capital-reporting,注明"不含初始账户闲置现金"口径),复用现有 .metric 与 formatMoney 数字格式、不加新字色;实验记录页条件差异表新增同口径三行(逐 run 对照,动作同步深化到 status/time 之后)。 [实现方案] 共享 capitalReporting 推导;resultsAccounting.test 断言更新为 9 张 metric 卡并新增三卡 DOM 实测断言。 [影响范围] ProjectResultsTab、RunsPage、resultsAccounting.test;vitest 84/84。 --- frontend/src/lib/resultsAccounting.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'frontend/src/lib') diff --git a/frontend/src/lib/resultsAccounting.test.ts b/frontend/src/lib/resultsAccounting.test.ts index cccb7ed..b695713 100644 --- a/frontend/src/lib/resultsAccounting.test.ts +++ b/frontend/src/lib/resultsAccounting.test.ts @@ -70,7 +70,11 @@ describe('results accounting labels + values (live browser accounting)', () => { expect(text).toContain('已完成的开仓并全部平仓的完整回合'); expect(text).not.toContain('成交次数(不含撤单)'); // numeric trade_count shows through: equity div reached rendering - expect(host.querySelectorAll('.metric').length).toBe(6); + // 投入口径 reporting(任务 A)追加 3 张卡:累计投入/持仓估值/回报率 → 9 + expect(host.querySelectorAll('.metric').length).toBe(9); + expect(host.querySelectorAll('[data-testid="capital-reporting"]').length).toBe(1); + expect(text).toContain('累计投入'); + expect(text).toContain('投入口径不含初始账户闲置现金'); // turnover: two fills with distinct values (buy vs sell prices differ) const rows = [...host.querySelectorAll('td.num')].map((td) => td.textContent.trim()); const hasSell = [...host.children].join('').includes('卖出'); -- cgit v1.2.3