diff --git a/e2e/tests/pages.spec.ts b/e2e/tests/pages.spec.ts index e212000e..a525f7d2 100644 --- a/e2e/tests/pages.spec.ts +++ b/e2e/tests/pages.spec.ts @@ -79,6 +79,13 @@ test('public reading page displays transcript and opens a working text export', await expect(ossBar.locator('a[href="https://github.com/zlxlabs/VideoTranscriptAPI"]')).toBeVisible(); await expect(ossBar.locator('a[href="https://x.com/bylixing"]')).toBeVisible(); + // Assert oss-bar does not overflow in 375px mobile viewport + await page.setViewportSize({ width: 375, height: 667 }); + await expect(ossBar).toContainText('张立行'); + const isNotOverflowing = await ossBar.evaluate((el) => el.scrollWidth <= el.clientWidth); + expect(isNotOverflowing).toBe(true); + await page.setViewportSize({ width: 1280, height: 720 }); + await expect(page.locator('#calibrated-content-block')).toContainText( '隔离浏览器夹具中的正文,验证公开阅读与导出。'); const exportMenu = page.locator('.export-links-details'); diff --git a/src/web/templates/base.html b/src/web/templates/base.html index 7c6cd011..41ac9e5a 100644 --- a/src/web/templates/base.html +++ b/src/web/templates/base.html @@ -877,23 +877,6 @@ transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease; } - .oss-bar-desc { - display: inline-flex; - align-items: center; - } - - .oss-bar-desc-desktop { - display: inline; - } - - .oss-bar-desc-mobile { - display: none; - } - - .oss-bar-author-label { - display: inline; - } - .oss-bar-sep { opacity: 0.6; user-select: none; @@ -936,18 +919,6 @@ display: none; } - .oss-bar-desc-desktop { - display: none; - } - - .oss-bar-desc-mobile { - display: inline; - } - - .oss-bar-author-label { - display: none; - } - .oss-bar-link { min-height: 32px; display: inline-flex; @@ -1135,25 +1106,22 @@
- ', html, re.DOTALL) + assert match is not None, "oss-bar element not found" + without_svg = re.sub(r'', '', match.group(1), flags=re.DOTALL) + visible_text = re.sub(r'<[^>]+>', '', without_svg) + + assert "@bylixing" not in visible_text + assert "GitHub ↗" not in visible_text + assert "本页由开源项目" not in visible_text + assert "可自行部署" not in visible_text + + for class_name in ["oss-bar-desc-desktop", "oss-bar-desc-mobile", "oss-bar-author-label"]: + assert class_name not in html def test_media_query_and_touch_target_in_styles(self): base_html = (TEMPLATES_DIR / "base.html").read_text(encoding="utf-8") assert "@media (max-width: 640px)" in base_html - assert ".oss-bar-desc-desktop" in base_html - assert ".oss-bar-desc-mobile" in base_html assert "min-height: 32px" in base_html + assert "white-space: nowrap" in base_html + assert ".oss-bar-desc-desktop" not in base_html + assert ".oss-bar-desc-mobile" not in base_html + assert ".oss-bar-author-label" not in base_html class TestNoLegacyRepoUrlsInWebAssets: