fix: listing review round — responsive grid collapse, branch fallback, test assertions

Quality review fixes for Task 10c (2 Important + 5 Minor):
- [I1] sf-tp-card-grid--listing now collapses to 2 cols at 900px and
  compact gap at 620px: the 3-col declaration sits after the 10a media
  blocks in source order, so the fold rules must live in the new 10c
  media blocks to win at equal specificity
- [I2] tp_post_like trusts the first listing item's content type when
  the list is non-empty; the route-substring fallback now only applies
  to empty listings of kind=='listing' — /categories/post-sales-service/
  style slugs can no longer flip a product category page into the news
  branch
- [M3] empty-state negative assertions check the rendered attribute
  string, not the selector literal (previously always true)
- [M4] catalogue section-head intro is now an item/page count instead
  of duplicating the hero lead
- [M5] Popular reads entries link to the posts (same data as Latest,
  no analytics source on the platform)
- [M6] both /categories/pumps/ pagination pages assert exactly one h1
- [M7] side-panel sticky top uses --sf-tp-space-24

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-23 14:26:34 +08:00
parent 9ea8369e2b
commit 8f8dfd19e5
3 changed files with 17 additions and 7 deletions
+4 -2
View File
@@ -282,6 +282,7 @@ def test_trade_pro_listing_layout_structure(factory):
cat1 = factory.get(f'/preview/{sid}/{bid}/categories/pumps/')
assert cat1.status_code == 200, cat1.text[:200]
s1 = BeautifulSoup(cat1.text, 'html.parser')
assert len(s1.find_all('h1')) == 1
nav1 = s1.select_one('nav.sf-tp-pagination')
assert nav1 is not None
assert len(s1.select('.sf-tp-card-grid--listing .sf-tp-card')) == 100
@@ -295,6 +296,7 @@ def test_trade_pro_listing_layout_structure(factory):
cat2 = factory.get(f'/preview/{sid}/{bid}/categories/pumps/page/2/')
assert cat2.status_code == 200, cat2.text[:200]
s2 = BeautifulSoup(cat2.text, 'html.parser')
assert len(s2.find_all('h1')) == 1
nav2 = s2.select_one('nav.sf-tp-pagination')
assert len(s2.select('.sf-tp-card-grid--listing .sf-tp-card')) == 5
prev = nav2.select_one('a[rel="prev"]')
@@ -330,8 +332,8 @@ def test_trade_pro_listing_layout_structure(factory):
# ── 空列表(/cases/ 无案例):整段隐藏换友好空态,不渲染筛选 ──
cases = factory.get(f'/preview/{sid}/{bid}/cases/').text
assert 'sf-tp-listing-empty' in cases
assert '[data-pro-filter-search]' not in cases
assert 'nav.sf-tp-pagination' not in cases
assert 'data-pro-filter-search' not in cases
assert 'sf-tp-pagination' not in cases
def test_frontend_entries_include_trade_pro():