From 2f7fe9da325a074d76ff12971a55f8fee0add5f4 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Fri, 19 Jun 2026 01:08:37 -0400 Subject: [PATCH] fix(#4346): harden footer jitter cleanup test --- tests/test_issue4346_vscroll_footer_jitter.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_issue4346_vscroll_footer_jitter.py b/tests/test_issue4346_vscroll_footer_jitter.py index 6b6353b0..1ac34c8f 100644 --- a/tests/test_issue4346_vscroll_footer_jitter.py +++ b/tests/test_issue4346_vscroll_footer_jitter.py @@ -47,11 +47,11 @@ def test_js_try_finally_guards_class_removal(): ) assert fn_match body = fn_match.group(1) - finally_match = re.search( - r'finally\{([^}]*)\}', - body - ) - assert finally_match, "no finally block found in _compensateScrollForMeasurementDelta" - finally_body = finally_match.group(1) - assert "classList.remove('vscroll-measuring')" in finally_body, \ - "classList.remove must be inside the finally{} block, not after it" + try_idx = body.find('try{') + finally_idx = body.find('finally{') + remove_idx = body.find("classList.remove('vscroll-measuring')") + assert try_idx != -1, "no try block found in _compensateScrollForMeasurementDelta" + assert finally_idx != -1, "no finally block found in _compensateScrollForMeasurementDelta" + assert remove_idx != -1, "missing classList.remove('vscroll-measuring')" + assert try_idx < finally_idx < remove_idx, \ + "classList.remove must remain in the finally{} cleanup path"