Repository navigation
test(ui): move code-block rendering tests beside their clipboard suite - #141494
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
182047d to
a7bdd01
Compare
a7bdd01 to
e01bfa5
Compare
ui/src/components/markdown.test.ts sits one line under the 700-line max-lines cap after #141466, #141485 and #141497 each moved a slice out. Move the toSanitizedMarkdownHtml code-block rendering cases into the existing markdown-code-blocks.test.ts, share htmlFragment and withControlUiBasePath from markdown.test-support.ts, and drop the copy of htmlFragment that markdown-streaming.test.ts carried. No assertion changes; the case count across ui/src/components/markdown*.test.ts is unchanged (232).
e01bfa5 to
eef42ed
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 4:12 PM ET / 20:12 UTC. ClawSweeper reviewWhat this changesMoves Markdown code-block rendering tests beside the clipboard tests and shares DOM-fragment and base-path test helpers. Merge readiness✅ Ready for maintainer review The previous HTML-fence finding is resolved, and no remaining actionable defect was found. This remains useful test organization beyond the already-merged splits and is protected maintainer-authored work. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI converts message Markdown into sanitized HTML and supplies code-block copy, expand, and wrap controls. These tests protect that rendering and interaction behavior without changing production code. flowchart LR
A[Markdown fixtures] --> B[Markdown renderer]
B --> C[Sanitized HTML]
C --> D[Rendering assertions]
C --> E[Code-block controls]
E --> F[Clipboard and interaction assertions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -8. Total -8 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep rendering and clipboard coverage together with shared test helpers, preserving the existing assertions and production behavior. Do we have a high-confidence way to reproduce the issue? Not applicable to this test reorganization; current source confirms the previous fixture defect is corrected, without executing tests. Is this the best way to solve the issue? Yes. Reusing the existing code-block suite and extracting unchanged test helpers is a focused way to improve organization without creating competing coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 631267364649. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
The identifier rename that avoids shadowing lit's html import also rewrote the fence language inside one fixture string, changing what highlightCodeHtml exercised. Restore the fixture; the moved block is now identical to its origin apart from the local variable name.
|
Merged via squash.
|
openclaw#141494) * test(ui): move code-block rendering tests beside their clipboard suite ui/src/components/markdown.test.ts sits one line under the 700-line max-lines cap after openclaw#141466, openclaw#141485 and openclaw#141497 each moved a slice out. Move the toSanitizedMarkdownHtml code-block rendering cases into the existing markdown-code-blocks.test.ts, share htmlFragment and withControlUiBasePath from markdown.test-support.ts, and drop the copy of htmlFragment that markdown-streaming.test.ts carried. No assertion changes; the case count across ui/src/components/markdown*.test.ts is unchanged (232). * test(ui): keep the html fence in the relocated escaping test The identifier rename that avoids shadowing lit's html import also rewrote the fence language inside one fixture string, changing what highlightCodeHtml exercised. Restore the fixture; the moved block is now identical to its origin apart from the local variable name.
What Problem This Solves
ui/src/components/markdown.test.tsfailed the repo's 700-linemax-linescap after #141369 and #141431 grew it, takingcheck-lint-core-2red on every open PR. Three concurrent splits (#141466, #141485, #141497) have since brought it to 699 non-blank lines — one line from red again. This gives it real headroom by moving the code-block rendering cases into the sibling suite that already owns code blocks.Why This Change Was Made
Split at the existing
describeseam and reuse the file that owns the subject instead of minting a near-duplicate:toSanitizedMarkdownHtmlcode blocks rendering cases (276 lines, 16 cases, regenerated from currentmainso the three cache cases test(ui): split markdown render-cache tests out of markdown.test.ts #141497 relocated are not duplicated) move into the existingmarkdown-code-blocks.test.tsas a top-level suite (458 non-blank lines after, under the cap);htmlFragmentandwithControlUiBasePathbecome onemarkdown.test-support.tsexport set;markdown-streaming.test.tsdrops its private copy ofhtmlFragment;markdown.test.tsends at 445 non-blank lines and sheds the imports only the moved cases used.The moved block's local
htmlvariables are renamedrenderedbecause the target file imports lit'shtml(eslintno-shadow). No assertion, test name, or fixture changed.Follow-up, deliberately not in this PR (to avoid colliding with the racing splits):
mainnow carries the streaming suite twice —markdown-streaming.test.ts(#141466) andmarkdown-streaming-parts.test.ts(#141485), 16 identical cases each. Delete the second.User Impact
None. Test-only; production LOC delta 0.
Evidence
ui/src/components/markdown*.test.ts: 232 before, 232 after (it(/test(); the moved block carries 16 cases.node scripts/run-vitest.mjson the four markdown suites: 4 files, 125 passed (125);markdown.test.tsalone: 52 passed.node_modules/.bin/oxlint -c .oxlintrc.jsonon the four touched files: clean (therun-oxlint.mjswrapper cannot run from a nested checkout; CI runs the wrapper).oxfmt --check: clean.Related: #141369 #141431 #141466 #141485 #141497