mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-18 21:50:55 +00:00
72c8effe67
Clean rebase of rodboev's #5770 (rebase-first). Co-authored-by: rodboev <rodboev@users.noreply.github.com>
24 lines
786 B
Python
24 lines
786 B
Python
from pathlib import Path
|
|
import re
|
|
|
|
|
|
REPO = Path(__file__).resolve().parent.parent
|
|
STYLE_CSS = (REPO / "static" / "style.css").read_text(encoding="utf-8")
|
|
|
|
|
|
def _base_msg_body_pre_rule() -> str:
|
|
match = re.search(r"(^|\n)\s*\.msg-body pre\{([^}]*)\}", STYLE_CSS)
|
|
assert match, "base .msg-body pre rule not found in style.css"
|
|
return match.group(2)
|
|
|
|
|
|
def test_msg_body_pre_containment_contract():
|
|
rule = _base_msg_body_pre_rule()
|
|
assert "overflow-x:auto" in rule, ".msg-body pre must keep horizontal scrolling"
|
|
assert "contain:content" in rule, ".msg-body pre must add contain: content"
|
|
|
|
|
|
def test_msg_body_pre_avoids_strict_containment():
|
|
rule = _base_msg_body_pre_rule()
|
|
assert "contain:strict" not in rule, ".msg-body pre must not use contain: strict"
|