feat: UX 2-Reihen-Button-Pattern — max 3 Buttons/Reihe, Nummern im Text+Button, Sonderschaltflächen separat
This commit is contained in:
@@ -154,8 +154,8 @@ class TestRenderReviewRoomStep:
|
||||
assert "Catch-All" in text
|
||||
assert "code" in text
|
||||
assert "bug" in text
|
||||
assert len(attachments) == 1
|
||||
assert len(attachments[0]["actions"]) >= 4 # 2 rooms + Neuer Raum + Überspringen
|
||||
assert len(attachments) == 2 # 1 nummeriert + 1 special (Neuer/Skip)
|
||||
assert len(attachments[0]["actions"]) >= 2 # 2 rooms in erster Reihe
|
||||
|
||||
def test_renders_empty_room_list(self):
|
||||
rm = _load_room_map([
|
||||
@@ -191,7 +191,7 @@ class TestRenderReviewRoomEdit:
|
||||
assert "code" in text
|
||||
assert "1️⃣ Kw100" in str(attachments)
|
||||
assert "3️⃣ Theme" in str(attachments)
|
||||
assert "4️⃣ Catch-All" in str(attachments)
|
||||
assert "4️⃣ Catch" in str(attachments)
|
||||
assert "5️⃣ Lösch" in str(attachments)
|
||||
assert "Zurück" in str(attachments)
|
||||
|
||||
@@ -295,8 +295,8 @@ class TestRenderReviewRoomRemove:
|
||||
])
|
||||
text, attachments = render_review_room_remove(rm, "r1", _mock_build_buttons)
|
||||
assert "wirklich entfernen" in text
|
||||
assert "✅ Löschen" in str(attachments)
|
||||
assert "Zurück" in str(attachments)
|
||||
assert "🗑️ Ja" in str(attachments)
|
||||
assert "Abbrechen" in str(attachments)
|
||||
|
||||
def test_rejects_catch_all_removal(self):
|
||||
rm = _load_room_map([
|
||||
@@ -731,10 +731,11 @@ class TestAllSubphasesHaveBack:
|
||||
"""UX-7: Alle Sub-Phasen haben Zurück-Button."""
|
||||
|
||||
def _has_back_button(self, attachments):
|
||||
"""Prüft ob Attachments einen '↩️ Zurück' Button enthalten."""
|
||||
"""Prüft ob Attachments einen '↩️ Zurück' oder '↩️ Abbrechen' Button enthalten."""
|
||||
for att in attachments:
|
||||
for action in att.get("actions", []):
|
||||
if "Zurück" in action.get("text", ""):
|
||||
text = action.get("text", "")
|
||||
if "Zurück" in text or "Abbrechen" in text:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -782,14 +783,14 @@ class TestAllSubphasesHaveBack:
|
||||
assert self._has_back_button(attachments), "catch_all_toggle sub-phase fehlt Zurück-Button"
|
||||
|
||||
def test_remove_subphase_has_back(self):
|
||||
"""review_room_remove hat Zurück-Button."""
|
||||
"""review_room_remove hat Abbrechen-Button."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords": ["code"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords": ["server"], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_remove(rm, "r1", _mock_build_buttons)
|
||||
assert self._has_back_button(attachments), "remove sub-phase fehlt Zurück-Button"
|
||||
assert self._has_back_button(attachments), "remove sub-phase fehlt Abbrechen-Button"
|
||||
|
||||
def test_add_new_subphase_has_back(self):
|
||||
"""review_room_add_new hat Zurück-Button."""
|
||||
@@ -1082,3 +1083,375 @@ class TestKeywordsContextDispatch:
|
||||
assert result is True
|
||||
assert "neues-kw" in rm.get_room_by_id("r1").keywords_100
|
||||
assert "neues-kw" not in rm.get_room_by_id("r1").keywords_context
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# UX REFACTOR: 2-Reihen-Button-Pattern Tests (Andreas' Spezifikation)
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# Import build_button_attachments — wird erst nach Implementierung existieren
|
||||
try:
|
||||
from plugin.archivar.onboarding_review import build_button_attachments
|
||||
_HAS_BUILD_BUTTON_ATTACHMENTS = True
|
||||
except ImportError:
|
||||
_HAS_BUILD_BUTTON_ATTACHMENTS = False
|
||||
|
||||
|
||||
class TestBuildButtonAttachments:
|
||||
"""build_button_attachments() — zentrale Helper-Funktion."""
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_splits_into_rows_of_max_3(self):
|
||||
"""5 nummerierte Buttons → 2 Attachments (3 + 2)."""
|
||||
num_buttons = [
|
||||
("Kw100", "REVIEW_ROOM_KW_ADD::r1"),
|
||||
("KwKtx", "REVIEW_ROOM_EDIT::r1::keywords_context"),
|
||||
("Theme", "REVIEW_ROOM_THEME_SAVE::r1"),
|
||||
("Catch", "REVIEW_ROOM_CATCHALL_SET::r1"),
|
||||
("Lösch", "REVIEW_ROOM_REMOVE_CONFIRM::r1"),
|
||||
]
|
||||
special_buttons = [("↩️ Zurück", "REVIEW_ROOM_BACK", "default")]
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
assert len(attachments) == 3 # 3+2 nummeriert + 1 special
|
||||
assert len(attachments[0]["actions"]) == 3
|
||||
assert len(attachments[1]["actions"]) == 2
|
||||
assert len(attachments[2]["actions"]) == 1 # Zurück
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_no_attachment_exceeds_3_actions(self):
|
||||
"""Kein Attachment hat >3 actions."""
|
||||
num_buttons = [
|
||||
(f"Btn{i}", f"PREFIX::btn{i}") for i in range(1, 8)
|
||||
]
|
||||
special_buttons = [("↩️ Zurück", "REVIEW_ROOM_BACK", "default")]
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
for att in attachments:
|
||||
assert len(att["actions"]) <= 3, \
|
||||
f"Attachment hat {len(att['actions'])} actions (>3)"
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_numbers_sequential(self):
|
||||
"""Nummerierte Buttons haben fortlaufende Nummern 1️⃣ 2️⃣ 3️⃣..."""
|
||||
num_buttons = [
|
||||
("A", "PREFIX::a"),
|
||||
("B", "PREFIX::b"),
|
||||
("C", "PREFIX::c"),
|
||||
("D", "PREFIX::d"),
|
||||
]
|
||||
special_buttons = []
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
all_labels = []
|
||||
for att in attachments:
|
||||
for action in att["actions"]:
|
||||
all_labels.append(action["text"])
|
||||
assert "1️⃣ A" in all_labels
|
||||
assert "2️⃣ B" in all_labels
|
||||
assert "3️⃣ C" in all_labels
|
||||
assert "4️⃣ D" in all_labels
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_special_buttons_no_numbers(self):
|
||||
"""Sonderschaltflächen haben KEINE Nummern."""
|
||||
num_buttons = [("Test", "PREFIX::test")]
|
||||
special_buttons = [
|
||||
("↩️ Zurück", "REVIEW_ROOM_BACK", "default"),
|
||||
("⏭️ Skip", "REVIEW_ROOM_SKIP", "default"),
|
||||
]
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
special_att = attachments[-1]
|
||||
for action in special_att["actions"]:
|
||||
label = action["text"]
|
||||
for num_emoji in ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣"]:
|
||||
assert num_emoji not in label, \
|
||||
f"Special button '{label}' hat Nummer {num_emoji}"
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_special_buttons_in_separate_attachment(self):
|
||||
"""Sonderschaltflächen sind im letzten Attachment."""
|
||||
num_buttons = [
|
||||
("A", "PREFIX::a"),
|
||||
("B", "PREFIX::b"),
|
||||
]
|
||||
special_buttons = [("↩️ Zurück", "REVIEW_ROOM_BACK", "default")]
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
last_att = attachments[-1]
|
||||
assert "↩️ Zurück" in [a["text"] for a in last_att["actions"]]
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_only_special_buttons(self):
|
||||
"""Nur Sonderschaltflächen → 1 Attachment."""
|
||||
num_buttons = []
|
||||
special_buttons = [("↩️ Zurück", "REVIEW_ROOM_BACK", "default")]
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
assert len(attachments) == 1
|
||||
assert len(attachments[0]["actions"]) == 1
|
||||
|
||||
@pytest.mark.skipif(not _HAS_BUILD_BUTTON_ATTACHMENTS,
|
||||
reason="build_button_attachments noch nicht implementiert")
|
||||
def test_only_numbered_buttons(self):
|
||||
"""Nur nummerierte Buttons → korrekte Aufteilung."""
|
||||
num_buttons = [
|
||||
("A", "PREFIX::a"),
|
||||
("B", "PREFIX::b"),
|
||||
("C", "PREFIX::c"),
|
||||
("D", "PREFIX::d"),
|
||||
]
|
||||
special_buttons = []
|
||||
attachments = build_button_attachments(num_buttons, special_buttons)
|
||||
assert len(attachments) == 2 # 3 + 1
|
||||
assert len(attachments[0]["actions"]) == 3
|
||||
assert len(attachments[1]["actions"]) == 1
|
||||
|
||||
|
||||
class TestButtonRowsMax3:
|
||||
"""Regel 2: Kein Attachment hat >3 actions (Integrationstests)."""
|
||||
|
||||
def _max_actions_per_attachment(self, attachments):
|
||||
return max((len(att.get("actions", [])) for att in attachments), default=0)
|
||||
|
||||
def test_room_edit_max_3_per_row(self):
|
||||
"""render_review_room_edit: max 3 actions pro Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "Entwicklung",
|
||||
"keywords_100": ["code", "bug"], "keywords_context": ["git"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "Betrieb",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_edit(rm, "r1", _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_edit: max {max_actions} actions in einem Attachment"
|
||||
|
||||
def test_keywords_edit_max_3_per_row(self):
|
||||
"""render_review_room_keywords_edit: max 3 actions pro Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev",
|
||||
"keywords_100": ["code", "bug", "test", "deploy", "ci", "docker", "git"],
|
||||
"keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_keywords_edit(rm, "r1", _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_keywords_edit: max {max_actions} actions in einem Attachment"
|
||||
|
||||
def test_catchall_toggle_max_3_per_row(self):
|
||||
"""render_review_room_catch_all_toggle: max 3 actions pro Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords": ["code"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords": ["server"], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_catch_all_toggle(rm, "r1", _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_catch_all_toggle: max {max_actions} actions in einem Attachment"
|
||||
|
||||
def test_remove_max_3_per_row(self):
|
||||
"""render_review_room_remove: max 3 actions pro Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords": ["code"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords": ["server"], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_remove(rm, "r1", _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_remove: max {max_actions} actions in einem Attachment"
|
||||
|
||||
def test_room_step_max_3_per_row(self):
|
||||
"""render_review_room_step: max 3 actions pro Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords_100": ["code"], "keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops", "keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
{"room_id": "r3", "name": "#QA", "theme": "qa", "keywords_100": ["test"], "keywords_context": []},
|
||||
{"room_id": "r4", "name": "#HR", "theme": "hr", "keywords_100": ["people"], "keywords_context": []},
|
||||
])
|
||||
_, attachments = render_review_room_step(rm, "dm123", _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_step: max {max_actions} actions in einem Attachment"
|
||||
|
||||
def test_add_new_max_3_per_row(self):
|
||||
"""render_review_room_add_new: max 3 actions pro Attachment."""
|
||||
available = [
|
||||
{"id": "new1", "name": "#Alpha", "type": "c"},
|
||||
{"id": "new2", "name": "#Beta", "type": "c"},
|
||||
{"id": "new3", "name": "#Gamma", "type": "c"},
|
||||
{"id": "new4", "name": "#Delta", "type": "c"},
|
||||
]
|
||||
_, attachments = render_review_room_add_new(available, _mock_build_buttons)
|
||||
max_actions = self._max_actions_per_attachment(attachments)
|
||||
assert max_actions <= 3, f"render_review_room_add_new: max {max_actions} actions in einem Attachment"
|
||||
|
||||
|
||||
class TestNumbersInText:
|
||||
"""Regel 1: Nummern im Nachrichtentext UND auf Schaltflächen."""
|
||||
|
||||
def test_room_edit_numbers_in_text(self):
|
||||
"""render_review_room_edit: Text enthält 1️⃣-5️⃣."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "Entwicklung",
|
||||
"keywords_100": ["code", "bug"], "keywords_context": ["git"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "Betrieb",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
text, _ = render_review_room_edit(rm, "r1", _mock_build_buttons)
|
||||
assert "1️⃣" in text, "Text enthält nicht 1️⃣"
|
||||
assert "2️⃣" in text, "Text enthält nicht 2️⃣"
|
||||
assert "3️⃣" in text, "Text enthält nicht 3️⃣"
|
||||
assert "4️⃣" in text, "Text enthält nicht 4️⃣"
|
||||
assert "5️⃣" in text, "Text enthält nicht 5️⃣"
|
||||
|
||||
def test_room_edit_numbers_on_buttons(self):
|
||||
"""render_review_room_edit: Buttons haben 1️⃣-5️⃣."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "Entwicklung",
|
||||
"keywords_100": ["code", "bug"], "keywords_context": ["git"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "Betrieb",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_edit(rm, "r1", _mock_build_buttons)
|
||||
all_labels = []
|
||||
for att in attachments:
|
||||
for action in att.get("actions", []):
|
||||
all_labels.append(action.get("text", ""))
|
||||
all_text = " ".join(all_labels)
|
||||
assert "1️⃣" in all_text, f"Buttons enthalten nicht 1️⃣: {all_labels}"
|
||||
assert "2️⃣" in all_text, f"Buttons enthalten nicht 2️⃣: {all_labels}"
|
||||
assert "3️⃣" in all_text, f"Buttons enthalten nicht 3️⃣: {all_labels}"
|
||||
assert "4️⃣" in all_text, f"Buttons enthalten nicht 4️⃣: {all_labels}"
|
||||
assert "5️⃣" in all_text, f"Buttons enthalten nicht 5️⃣: {all_labels}"
|
||||
|
||||
|
||||
class TestSpecialButtonsSeparateRow:
|
||||
"""Regel 3: Sonderschaltflächen in separater Reihe."""
|
||||
|
||||
def _get_special_labels(self, attachments):
|
||||
"""Extrahiert Labels aus dem letzten Attachment."""
|
||||
if not attachments:
|
||||
return []
|
||||
return [a.get("text", "") for a in attachments[-1].get("actions", [])]
|
||||
|
||||
def test_room_edit_back_in_separate_row(self):
|
||||
"""render_review_room_edit: ↩️ Zurück in separatem Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "Entwicklung",
|
||||
"keywords_100": ["code", "bug"], "keywords_context": ["git"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "Betrieb",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_edit(rm, "r1", _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "↩️ Zurück" in special_labels, \
|
||||
f"↩️ Zurück nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
def test_keywords_edit_back_in_separate_row(self):
|
||||
"""render_review_room_keywords_edit: ↩️ Zurück in separatem Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev",
|
||||
"keywords_100": ["code", "bug", "test", "deploy"],
|
||||
"keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_keywords_edit(rm, "r1", _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "↩️ Zurück" in special_labels, \
|
||||
f"↩️ Zurück nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
def test_catchall_toggle_back_in_separate_row(self):
|
||||
"""render_review_room_catch_all_toggle: ↩️ Zurück in separatem Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords": ["code"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords": ["server"], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_catch_all_toggle(rm, "r1", _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "↩️ Zurück" in special_labels, \
|
||||
f"↩️ Zurück nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
def test_remove_back_in_separate_row(self):
|
||||
"""render_review_room_remove: ↩️ Abbrechen in separatem Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords": ["code"]},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords": ["server"], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_remove(rm, "r1", _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "↩️ Abbrechen" in special_labels, \
|
||||
f"↩️ Abbrechen nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
def test_room_step_special_in_separate_row(self):
|
||||
"""render_review_room_step: ➕ Neuer + ⏭️ Skip in separatem Attachment."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev", "keywords_100": ["code"], "keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops", "keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_step(rm, "dm123", _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "➕ Neuer" in special_labels or "⏭️ Skip" in special_labels, \
|
||||
f"Sonderschaltflächen nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
def test_add_new_back_in_separate_row(self):
|
||||
"""render_review_room_add_new: ↩️ Zurück in separatem Attachment."""
|
||||
available = [
|
||||
{"id": "new1", "name": "#Alpha", "type": "c"},
|
||||
{"id": "new2", "name": "#Beta", "type": "c"},
|
||||
]
|
||||
_, attachments = render_review_room_add_new(available, _mock_build_buttons)
|
||||
assert len(attachments) >= 2, f"Nur {len(attachments)} Attachments, erwartet >=2"
|
||||
special_labels = self._get_special_labels(attachments)
|
||||
assert "↩️ Zurück" in special_labels, \
|
||||
f"↩️ Zurück nicht in letztem Attachment: {special_labels}"
|
||||
|
||||
|
||||
class TestKeywordXButtonsNotNumbered:
|
||||
"""Keyword-X-Buttons haben KEINE Nummern (Regel 1 Ausnahme)."""
|
||||
|
||||
def test_keyword_x_buttons_no_numbers(self):
|
||||
"""render_review_room_keywords_edit: X-Buttons ohne Nummern-Emoji."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev",
|
||||
"keywords_100": ["code", "bug", "test"],
|
||||
"keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_keywords_edit(rm, "r1", _mock_build_buttons)
|
||||
x_labels = []
|
||||
for att in attachments:
|
||||
for action in att.get("actions", []):
|
||||
label = action.get("text", "")
|
||||
if "❌" in label:
|
||||
x_labels.append(label)
|
||||
assert len(x_labels) >= 3, f"Erwartet >=3 X-Buttons, gefunden: {x_labels}"
|
||||
for label in x_labels:
|
||||
for num_emoji in ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]:
|
||||
assert num_emoji not in label, \
|
||||
f"X-Button '{label}' hat Nummer {num_emoji}"
|
||||
|
||||
def test_keyword_x_buttons_in_3er_blocks(self):
|
||||
"""render_review_room_keywords_edit: 7 Keywords → 3+3+1 X-Buttons + Zurück."""
|
||||
rm = _load_room_map([
|
||||
{"room_id": "r1", "name": "#Dev", "theme": "dev",
|
||||
"keywords_100": ["a", "b", "c", "d", "e", "f", "g"],
|
||||
"keywords_context": []},
|
||||
{"room_id": "r2", "name": "#Ops", "theme": "ops",
|
||||
"keywords_100": ["server"], "keywords_context": [], "catch_all": True},
|
||||
])
|
||||
_, attachments = render_review_room_keywords_edit(rm, "r1", _mock_build_buttons)
|
||||
assert len(attachments) >= 3, \
|
||||
f"Erwartet >=3 Attachments (3+3+1 X + Zurück), gefunden: {len(attachments)}"
|
||||
for att in attachments:
|
||||
assert len(att["actions"]) <= 3, \
|
||||
f"Attachment hat {len(att['actions'])} actions (>3)"
|
||||
|
||||
Reference in New Issue
Block a user