From 5d83dd977678cc82a9d8fb491949922fe02bc49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Wed, 30 Sep 2026 13:59:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=82=80=E8=AF=B7=E5=8D=A1=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E8=81=94=E5=8A=A8=E2=80=94=E2=80=94invite-container?= =?UTF-8?q?=E5=90=8C=E6=AC=BEright:0=E7=A1=AC=E7=BC=96=E7=A0=81=E5=9C=A8bo?= =?UTF-8?q?ttom-left=E6=BA=A2=E5=87=BA(=E7=94=A8=E6=88=B7=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E5=8F=8D=E9=A6=88,=E8=A1=A5=E9=BD=90chat-panel?= =?UTF-8?q?=E8=81=94=E5=8A=A8=E9=81=97=E6=BC=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试提取器正则同步收紧(排除联动规则误匹配)。 Co-Authored-By: Claude Code --- static/widget.js | 14 +++++++++----- tests/test_invite_static.py | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/static/widget.js b/static/widget.js index 773a209..712d7ad 100644 --- a/static/widget.js +++ b/static/widget.js @@ -179,11 +179,15 @@ // Chat panel ".chat-panel { position:absolute; bottom:80px; right:0; width:400px; height:540px; background:" + c.bg + "; border-radius:16px; box-shadow:0 10px 40px rgba(0,0,0,0.15); display:none; flex-direction:column; overflow:hidden; }", ".chat-panel.open { display:flex; }", - // 位置联动(2026-09-30 修复): 面板对齐随 data-position 翻转,默认 right:0 - // 只适配 bottom-right——左侧模式溢出屏幕、顶部模式向上溢出 - ".widget-container.pos-bottom-left .chat-panel { left:0; right:auto; }", - ".widget-container.pos-top-right .chat-panel { top:0; bottom:auto; }", - ".widget-container.pos-top-left .chat-panel { left:0; right:auto; top:0; bottom:auto; }", + // 位置联动(2026-09-30 修复): 面板/邀请卡对齐随 data-position 翻转, + // 默认 right:0 只适配 bottom-right——左侧模式溢出屏幕、顶部模式向上溢出 + // (邀请卡 invite-container 与 chat-panel 同款定位,必须一起联动) + ".widget-container.pos-bottom-left .chat-panel," + + " .widget-container.pos-bottom-left .invite-container { left:0; right:auto; }", + ".widget-container.pos-top-right .chat-panel," + + " .widget-container.pos-top-right .invite-container { top:0; bottom:auto; }", + ".widget-container.pos-top-left .chat-panel," + + " .widget-container.pos-top-left .invite-container { left:0; right:auto; top:0; bottom:auto; }", // Panel header ".panel-header { display:flex; align-items:center; gap:12px; padding:14px 18px; background:var(--w-primary); color:white; }", diff --git a/tests/test_invite_static.py b/tests/test_invite_static.py index c68be57..ff94192 100644 --- a/tests/test_invite_static.py +++ b/tests/test_invite_static.py @@ -40,7 +40,9 @@ def test_invite_panel_ships_hidden(): def test_invite_container_click_through(): """C:容器 pointer-events:none —— 卡片未展示时整棵子树点击穿透。""" - m = re.search(r"\.invite-container \{[^}]*\}", _read("widget.js")) + # 行首引号锚定原始定义行——位置联动规则(.widget-container.pos-* .invite-container) + # 同样匹配宽松正则,须排除(2026-09-30 邀请卡联动修复时的提取器缺陷) + m = re.search(r'"\.invite-container \{[^}]*\}', _read("widget.js")) assert m, "widget.js 缺 .invite-container 规则" assert "pointer-events:none" in m.group(0), \ ".invite-container 必须 pointer-events:none(防隐形拦截点击)" @@ -92,9 +94,17 @@ def test_position_class_panel_alignment(): # 2) 容器挂载位置 class assert '"widget-container pos-" + position' in src, "container 需挂 pos- class" # 3) CSS 联动规则: 左侧模式面板左对齐, 顶部模式面板从顶部向下弹 - assert ".widget-container.pos-bottom-left .chat-panel { left:0; right:auto; }" in src - assert ".widget-container.pos-top-right .chat-panel { top:0; bottom:auto; }" in src - assert ".widget-container.pos-top-left .chat-panel { left:0; right:auto; top:0; bottom:auto; }" in src + # ⚠️ chat-panel 与 invite-container(邀请卡)是同款 absolute+right:0 定位, + # 必须一起联动(2026-09-30 二次线上反馈: 邀请卡漏修同样溢出) + for rule_sel, rule_body in [ + (".widget-container.pos-bottom-left .chat-panel,", None), + (".widget-container.pos-bottom-left .invite-container { left:0; right:auto; }", None), + (".widget-container.pos-top-right .chat-panel,", None), + (".widget-container.pos-top-right .invite-container { top:0; bottom:auto; }", None), + (".widget-container.pos-top-left .chat-panel,", None), + (".widget-container.pos-top-left .invite-container { left:0; right:auto; top:0; bottom:auto; }", None), + ]: + assert rule_sel in src, f"缺联动规则: {rule_sel}" # 4) pos 规则须在 mobile-host 规则之后注入(同特异性靠顺序决胜, 不得被 bottom:84px 覆盖打断) mobile_rule = ".widget-container.mobile-host .chat-panel { bottom:84px; }" pos_rule = ".widget-container.pos-bottom-left .chat-panel"