From e2fc1d77a64f5a8a0fc5015d69feb28f665d6f23 Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Wed, 14 Oct 2026 09:20:16 +0800 Subject: [PATCH] test: distinguish thread parent links from latest navigation --- tests/test_thread_tree.py | 12 ++++++++++++ tests/test_thread_tree_http.py | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_thread_tree.py b/tests/test_thread_tree.py index fd015c96..55b8d40a 100644 --- a/tests/test_thread_tree.py +++ b/tests/test_thread_tree.py @@ -202,3 +202,15 @@ def test_incorrect_statistics_types_are_unknown_not_coerced_into_counts(count, c ) assert '>回复数未知' in page and '>浏览量未知' in page assert '>-1 条回复' not in page and '>1 浏览' not in page + + +def test_latest_visible_parent_navigation_is_not_a_child_parent_link(): + # Fixed page order: the branch is visible and latest; its child is off-page. + sibling, branch = post(3, 1), post(2, 1) + sibling['created_at'] = '2026-10-04T10:00:00Z' + branch['created_at'] = '2026-10-04T10:20:00Z' + fragment = thread_fragment_html([sibling, branch], {'root': key(1)}) + assert f'id="reply-{key(2)}"' in fragment + assert f'id="reply-{key(4)}"' not in fragment + assert f'最新回复' in fragment + assert f'