main
py 35 lines 1.11 KB
Raw
1 from pathlib import Path
2
3
4 PROJECT_ROOT = Path(__file__).resolve().parents[1]
5
6
7 def test_message_action_buttons_are_not_text_selectable() -> None:
8 css = PROJECT_ROOT.joinpath(
9 "webui",
10 "components",
11 "messages",
12 "action-buttons",
13 "simple-action-buttons.css",
14 ).read_text(encoding="utf-8")
15
16 block = css[css.index(".step-action-buttons {"):css.index("}", css.index(".step-action-buttons {"))]
17 assert "user-select: none;" in block
18
19
20 def test_streaming_updates_keep_action_button_nodes_mounted() -> None:
21 actions = PROJECT_ROOT.joinpath(
22 "webui",
23 "components",
24 "messages",
25 "action-buttons",
26 "simple-action-buttons.js",
27 ).read_text(encoding="utf-8")
28 messages = PROJECT_ROOT.joinpath("webui", "js", "messages.js").read_text(
29 encoding="utf-8"
30 )
31
32 assert "existing.__actionHandler = button.__actionHandler" in actions
33 assert "syncActionButtons(stepActionBtns, actionButtons);" in messages
34 assert "syncActionButtons(container, actionButtons);" in messages
35 assert 'stepActionBtns.textContent = "";' not in messages