test(chat): update 6 post-render tests orphaned by the _postProcessWithAnchorSuppression refactor (#5338)

Commit 7536f6f1 routed the deferred post-render dispatches through
_postProcessWithAnchorSuppression() (holds overflow-anchor suppression across
the async media/layout settle frame, then calls postProcessRenderedMessages).
Six pre-existing tests string-matched the old
'requestAnimationFrame(()=>postProcessRenderedMessages(inner))' literal and
failed on the rename — behavior is preserved (the wrapper still invokes
postProcessRenderedMessages), so this is a test-fix not a code-fix.

Per the gate-cert recommendation, the tests now assert the BEHAVIOR chain
(post-render is scheduled via _postProcessWithAnchorSuppression, and that
wrapper calls postProcessRenderedMessages) rather than the exact rAF literal, so
a future wrapper rename can't re-orphan them.

Files: test_csv_table_rendering, test_excalidraw_inline_embed,
test_issue483_inline_diff_viewer, test_issue484_json_tree_viewer, test_issue347,
test_pdf_html_preview. Verified: the 6 updated assertions pass locally (the only
local failures are the pre-existing Windows-only WinError 206 command-line-too-long
in Node-harness tests, unrelated, green on Linux CI).
This commit is contained in:
allenliang2022 authored and nesquena-hermes committed 2026-07-01 17:46:03 +00:00
1 parent 7db6fd8650
commit fbb21964a9
6 files changed
+47 -6

No files matched your search

+7 -1
View File
@@ -62,7 +62,13 @@ class TestMediaDiffInline:
"""loadDiffInline() should be called by the consolidated post-render pass."""
with open("static/ui.js", "r", encoding="utf-8") as f:
content = f.read()
assert "requestAnimationFrame(()=>postProcessRenderedMessages(inner))" in content
# Behavior assertion (#5338): post-render scheduled via
# _postProcessWithAnchorSuppression, which still calls postProcessRenderedMessages.
assert "requestAnimationFrame(()=>_postProcessWithAnchorSuppression(" in content
_wrap = content.find('function _postProcessWithAnchorSuppression')
assert _wrap != -1, "post-render should be wrapped by _postProcessWithAnchorSuppression"
assert 'postProcessRenderedMessages(container)' in content[_wrap:_wrap + 500], \
"the wrapper must still invoke postProcessRenderedMessages"
start = content.find("function postProcessRenderedMessages")
body = content[start:start + 500]
assert "addCopyButtons(container)" in body