fix: 邀请卡位置联动——invite-container同款right:0硬编码在bottom-left溢出(用户二次反馈,补齐chat-panel联动遗漏)
测试提取器正则同步收紧(排除联动规则误匹配)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+9
-5
@@ -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; }",
|
||||
|
||||
@@ -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-<position> 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"
|
||||
|
||||
Reference in New Issue
Block a user