summaryrefslogtreecommitdiff
path: root/frontend/src/lib/resultsAccounting.test.ts
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-18 15:49:44 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-18 15:49:44 +0800
commit375584174fb7191a57c5423fea45924ad6d812d5 (patch)
tree76042d5d38b8aafc8bb7b30caa6f8e04fc3305c1 /frontend/src/lib/resultsAccounting.test.ts
parentfc952a2876362bf834a60c35ef0f70b0278df197 (diff)
downloadstrategy-lab-375584174fb7191a57c5423fea45924ad6d812d5.tar.gz
[变更性质] feat(frontend)
[新增功能] round5 主题基线重置:shadcn preset b6t6C6CTw CLI init、app.css 仅保留 tailwind + shadcn 主题变量层 [实现方案] 删除 round3 自定义 token/布局原语/legacy 别名;theme.ts 删除;mobileCss 守门测试重写 [影响范围] src/app.css、components.json、lib/utils.ts、lib/theme.ts、测试
Diffstat (limited to 'frontend/src/lib/resultsAccounting.test.ts')
-rw-r--r--frontend/src/lib/resultsAccounting.test.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/frontend/src/lib/resultsAccounting.test.ts b/frontend/src/lib/resultsAccounting.test.ts
index 5dc5bd6..deedaa9 100644
--- a/frontend/src/lib/resultsAccounting.test.ts
+++ b/frontend/src/lib/resultsAccounting.test.ts
@@ -71,17 +71,17 @@ describe('results accounting labels + values (live browser accounting)', () => {
expect(text).not.toContain('成交次数(不含撤单)');
// numeric trade_count shows through: equity div reached rendering
// 投入口径 reporting(任务 A)追加 3 张卡:累计投入/持仓估值/回报率 → 9
- expect(host.querySelectorAll('[data-slot="card"].m-tile, .m-tile').length).toBe(9);
+ expect(host.querySelectorAll('[data-slot="card"].gap-1').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 rows = [...host.querySelectorAll('[data-testid="capital-reporting"]').length ? host.querySelectorAll('td') : []].length >= 0 ? [...host.querySelectorAll('td')].map((td) => td.textContent.trim()) : [];
const hasSell = [...host.children].join('').includes('卖出');
// the trades table renders the sell row with its OWN value (1040), not the buy's cost basis
expect(rows.filter((v) => v === '1020.00' || v === '1040.00').length).toBe(2);
// trade_count metric value renders
- expect([...host.querySelectorAll('.mvalue')].some((n) => n.textContent === '1')).toBe(true);
+ expect([...host.querySelectorAll('[data-testid="metric-value"]')].some((n) => n.textContent === '1')).toBe(true);
} finally { unmount(inst); host.remove(); vi.unstubAllGlobals(); } });
it('comparison labels use the same closed-round-trip semantics', () => {