summaryrefslogtreecommitdiff
path: root/frontend/scripts
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-18 12:03:32 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-18 12:03:32 +0800
commit17e30105538f419c6abef2a69ffd4f0eb4cf238b (patch)
tree23b79c0b4f0f7aca67a3e33ae88b95cb9a991ec0 /frontend/scripts
parent61f5c545953bb4ee20b123bf9671ac35d7f1f3c1 (diff)
downloadstrategy-lab-17e30105538f419c6abef2a69ffd4f0eb4cf238b.tar.gz
[变更性质] test(frontend)
[新增功能] 测试与 probe 同步:mobileCss round3 断言、resultsAccounting .m-tile、strategyTab 超时放宽、probe radius 断言 [实现方案] probe cardRadiusOk 校验 --radius≥0.75rem 且组件计算圆角一致;88/88 vitest 全绿 [影响范围] src/lib/*.test.ts、scripts/ui-auth-shots.mjs
Diffstat (limited to 'frontend/scripts')
-rw-r--r--frontend/scripts/ui-auth-shots.mjs17
1 files changed, 17 insertions, 0 deletions
diff --git a/frontend/scripts/ui-auth-shots.mjs b/frontend/scripts/ui-auth-shots.mjs
index 9507b6d..2db1f1d 100644
--- a/frontend/scripts/ui-auth-shots.mjs
+++ b/frontend/scripts/ui-auth-shots.mjs
@@ -155,6 +155,22 @@ for (const w of widths) {
breadcrumbText: document.querySelector('nav.crumbs')?.textContent.replace(/\s+/g, ' ').trim() || null,
sparklineCells: document.querySelectorAll('[data-testid="sparkline-cell"]').length,
metricCards: document.querySelectorAll('[data-testid="metric-card"]').length,
+ cardRadius: (function () {
+ const r = document.querySelector('[data-slot="card"]');
+ if (!r) return null;
+ const target = String(getComputedStyle(document.documentElement).getPropertyValue('--radius')).trim();
+ return { computed: getComputedStyle(r).borderRadius, token: getComputedStyle(document.documentElement).getPropertyValue('--radius') || target };
+ })(),
+ cardRadiusOk: (function () {
+ const r = document.querySelector('[data-slot="card"]');
+ if (!r) return null;
+ const root = getComputedStyle(document.documentElement);
+ const tok = parseFloat(root.getPropertyValue('--radius'));
+ const rootFs = parseFloat(root.fontSize);
+ const expected = tok * rootFs;
+ const n = parseFloat(getComputedStyle(r).borderRadius);
+ return n >= expected - 0.5 && tok >= 0.749;
+ })(),
projects: (window.__probeProjects !== undefined) ? window.__probeProjects : null,
runs: null,
hasEquity: null,
@@ -170,6 +186,7 @@ for (const w of widths) {
' overflow=' + dom.overflow + ' pageErrors=' + pageErrors.length +
' tabbarAttached=' + dom.tabbarAttached + ' tabbarVisible=' + dom.tabbarVisible +
' metricCards=' + dom.metricCards + ' sparks=' + dom.sparklineCells +
+ ' radiusOk=' + dom.cardRadiusOk +
(dom.breadcrumbText ? ' crumbs="' + dom.breadcrumbText + '"' : '')
);
if (dom.overflow !== 0 || pageErrors.length !== 0) bad++;