v1.3.0: 修复验收链路(iframe 真实渲染+跨帧断言)、基座焦点环、契约第二批 15 个

回归通过率此前不可信:run-tests.ps1 抽取演示页 body 时剥离全部 <script>,
而 79 个 H5 演示页的 DOM 全由内联脚本渲染,且测试页从未引用 frameworks/<组件>.css
—— 断言跑在空 DOM + 无组件样式上,v1.2.0 的 75.1% 属结构性误报。

Fixed — 验收链路
- 测试页改为 iframe 加载真实演示页(_template.html),_runtime.js 跨帧在真实
  渲染结果上断言:帧内 getComputedStyle/styleSheets/outerHTML,用例自动标注 +
  帧内描边,结果 postMessage 上报
- 标注改为容器下钻(.row/.demo-block → 首个含 ≥2 有效子元素的容器,最多 6 层)
- 新增 N/A 语义:静态组件键盘/ARIA 记 skip 而非失败;对比度与 token 检查限定
  在被测组件区,页头文档文字不计
- 通过率分母改为 pass/(pass+fail),tools/run-regression.mjs 与收集器同口径

Added — 设计系统
- 基座 :focus-visible 统一焦点环(colors_and_type.css)。--au-color-focus-ring
  此前只定义未消费,79 个组件样式仅 20 个自带 focus 规则 —— 一次性消除 66 页失败
- tests/_collect.html:零依赖浏览器批量回归收集器(并发 iframe + 汇总)
- tests/_index_template.html:测试总览页模板外置,读数来自 data.json

Added — 契约第二批(展示类 15 个)
- tree/collapse/calendar/carousel/imagepreview/qrcode/countdown/watermark/
  cardlist/treetable/timelinelist/steplist/chartpanel/dashboardcard/employeecard
- 逐份从规格原文(组件2/4/7/9.txt)提炼,含 dims/variants/anatomy/structure/
  usageHints/doNotInvent/unknowns;契约化 21 → 36/79

Changed
- run-tests.ps1 重写:删除失效的快照抽取(占位符替换早已不匹配模板),改生成
  iframe 版测试页;输出 WriteAllText 无 BOM;保持 ASCII-only,中文移入 UTF-8 模板
- 回归基线:960 断言 / 794 通过 / 85.1% / 11 页全通过 / N/A 27
- CHANGELOG/TESTING/改造清单同步;测试总览页与首页通过率联动

验证:浏览器全量 79 页收集器跑通两次,基线一致;详情页契约章节
(含 doNotInvent/unknowns)、chip、首页「通过率 85.1%」、changelog v1.3.0 实测通过
This commit is contained in:
aurora-admin
2026-09-10 21:19:09 +08:00
parent 0289c8acfc
commit 6fec4ba6f8
110 changed files with 4310 additions and 3419 deletions
+17 -25
View File
@@ -21,7 +21,7 @@ body { margin: 0; font-family: var(--au-font-family); color: var(--au-color-text
.t-section { background: var(--au-color-card-bg); border: 1px solid var(--au-color-border); border-radius: var(--au-radius-large); padding: 20px; margin-bottom: 20px; }
.t-section h2 { font-size: 16px; margin: 0 0 12px; color: var(--au-color-text-title); }
.t-section .desc { color: var(--au-color-text-secondary); font-size: 13px; margin: 0 0 12px; }
.t-summary { display: flex; gap: 12px; align-items: center; }
.t-summary { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.t-pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 10px; border-radius: var(--au-radius-small); font-size: 12px; background: var(--au-color-table-header-bg); color: var(--au-color-text-secondary); font-family: var(--au-font-family-num); }
.t-pill.pass { background: rgba(82,196,26,.12); color: var(--au-color-success); }
.t-pill.fail { background: rgba(245,34,45,.12); color: var(--au-color-error); }
@@ -31,10 +31,9 @@ body { margin: 0; font-family: var(--au-font-family); color: var(--au-color-text
.t-row .id { font-family: var(--au-font-family-num); color: var(--au-color-text-secondary); flex: 1; word-break: break-all; }
.t-row .ms { font-family: var(--au-font-family-num); color: var(--au-color-text-placeholder); font-size: 12px; }
.t-row .err { color: var(--au-color-error); font-size: 12px; margin-left: 8px; }
[data-assert] { outline: 2px dashed transparent; transition: outline-color .15s; }
[data-assert][data-status="pass"] { outline-color: rgba(82,196,26,.45); }
[data-assert][data-status="fail"] { outline-color: rgba(245,34,45,.55); }
[data-assert][data-status="skip"] { outline-color: rgba(140,140,140,.4); }
.t-snap-head { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
#snapshot { border: 1px solid var(--au-color-border); border-radius: var(--au-radius-medium); overflow: hidden; background: #fff; }
#snapshot iframe { width: 100%; height: 560px; border: 0; display: block; }
.t-fab { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.t-fab .t-btn { box-shadow: var(--au-shadow-medium); }
.t-toast { position: fixed; top: 24px; right: 24px; z-index: 200; padding: 8px 14px; background: var(--au-color-text-title); color: var(--au-color-text-inverse); border-radius: var(--au-radius-base); font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
@@ -54,23 +53,15 @@ body { margin: 0; font-family: var(--au-font-family); color: var(--au-color-text
</div>
<div class="t-section">
<h2>渲染快照</h2>
<p class="desc">以下 DOM 是组件主用例的静态快照,每个用例标注 <code>data-assert="&lt;id&gt;"</code>,点击「运行断言」后会写入 <code>data-status</code>。</p>
<h2>渲染快照(真实演示页)</h2>
<p class="desc">iframe 直接加载 <code>frameworks/Tree.html</code>:组件 CSS 与内联脚本真实执行,用例由运行期标注 <code>data-assert="&lt;id&gt;"</code>,断言在帧内运行后写回 <code>data-status</code>(帧内描边可视化)。</p>
<div class="t-snap-head">
<a class="t-btn" href="../frameworks/Tree.html" target="_blank">↗ 新窗口打开演示页</a>
<button id="reload-frame" class="t-btn" type="button">重载演示页</button>
<span class="t-pill" id="frame-state">加载中…</span>
</div>
<div id="snapshot">
<!-- 渲染快照由生成器写入 -->
<div class="demo">
<h1>Aurora Admin · Tree 组件(纯 H5)</h1>
<p class="sub">对齐 Tree 规范:节点高32px、缩进16px/级、箭头12px、选中态 #F0F5FF + 品牌色、支持复选框级联</p>
<label style="font-size:13px;color:#8C8C8C;margin-right:16px;">
<input type="checkbox" id="chkToggle" checked> 启用复选框
</label>
<div class="aa-tree" id="tree" style="margin-top:12px"></div>
</div>
<iframe id="snapshot-frame" src="../frameworks/Tree.html" title="tree 组件演示页"></iframe>
</div>
</div>
@@ -88,16 +79,17 @@ body { margin: 0; font-family: var(--au-font-family); color: var(--au-color-text
<div class="t-section">
<h2>通用测试矩阵(自动断言)</h2>
<p class="desc">以下 8 项检查在「运行断言」时同时跑:默认态、变体覆盖、状态可达、键盘可达、焦点环、ARIA 属性、对比度、token 一致性。</p>
<p class="desc">以下检查在「运行断言」时于演示页帧内同时跑:默认态、变体覆盖、状态可达、可见用例、键盘可达、焦点环、ARIA 属性、对比度、token 一致性。</p>
<ol style="margin: 0; padding-left: 18px; color: var(--au-color-text-body); font-size: 13px; line-height: 22px;">
<li>默认态渲染:核心节点齐全</li>
<li>尺寸/类型变体:≥2 尺寸 或 ≥2 类型</li>
<li>状态覆盖:default / hover / focus / disabled / loading 至少出现 3 个</li>
<li>状态覆盖:default / hover / focus / disabled / loading 至少出现 1 个(或 ≥3 个用例)</li>
<li>可见用例:≥1 个用例在默认态可见(隐藏用例记 skip)</li>
<li>键盘可达:可聚焦元素具备 tabindex 或原生 button/a</li>
<li>焦点环可视:focus-visible 描边不被覆盖(脚本检查 stylesheet)</li>
<li>ARIA 属性:交互节点具备 role 或 aria-*</li>
<li>对比度:主要文本颜色与背景对比度 ≥ 4.5:1</li>
<li>token 一致性:未出现硬编码 hex 颜色 / 像素值</li>
<li>对比度:用例区文本颜色与背景对比度 ≥ 4.5:1(页头文档文字不计)</li>
<li>token 一致性:用例区未出现硬编码 hex 颜色</li>
</ol>
</div>
</div>