fix(web-probe): 对齐新版 MDTODO DOM 合同

This commit is contained in:
Codex
2026-07-13 14:23:05 +02:00
parent c5e8f163b5
commit cd7fb392f6
4 changed files with 114 additions and 28 deletions
@@ -7,10 +7,32 @@ import {
} from "./hwlab-node-web-observe-runner-sampling-source";
test("MDTODO task tree pane gap treats the pinned facts footer as content", async () => {
assert.match(MDTODO_TASK_TREE_PANE_CONTENT_SELECTOR, /\[data-testid="mdtodo-task-tree-facts"\]/u);
assert.match(
MDTODO_TASK_TREE_PANE_CONTENT_SELECTOR,
/\[data-testid="mdtodo-task-tree-facts"\]/u,
);
assert.match(
MDTODO_TASK_TREE_PANE_CONTENT_SELECTOR,
/\[data-testid="mdtodo-task-page-fact"\]/u,
);
const source = nodeWebObserveRunnerSamplingSource();
assert.ok(source.includes(`measurePaneGap("task-tree", '[data-testid="mdtodo-task-tree"]', ${JSON.stringify(MDTODO_TASK_TREE_PANE_CONTENT_SELECTOR)})`));
assert.ok(
source.includes(
`measurePaneGap("task-tree", '[data-testid="mdtodo-task-tree"]', ${JSON.stringify(MDTODO_TASK_TREE_PANE_CONTENT_SELECTOR)})`,
),
);
assert.match(
source,
/semanticTaskCandidates\.length > 0 \? semanticTaskCandidates : fallbackTaskCandidates/u,
);
assert.match(
source,
/taskCandidates\.filter\(\(candidate\) => !taskRefElement\(candidate\)\)\.length/u,
);
assert.doesNotMatch(source, /taskCandidates\.length - taskItems\.length/u);
assert.match(source, /mdtodo-body-read/u);
assert.match(source, /mdtodo-launch-workbench/u);
const child = Bun.spawn(["node", "--input-type=module", "--check", "-"], {
stdin: "pipe",
@@ -19,6 +41,9 @@ test("MDTODO task tree pane gap treats the pinned facts footer as content", asyn
});
child.stdin.write(source);
child.stdin.end();
const [stderr, exitCode] = await Promise.all([new Response(child.stderr).text(), child.exited]);
const [stderr, exitCode] = await Promise.all([
new Response(child.stderr).text(),
child.exited,
]);
assert.equal(exitCode, 0, stderr);
});