diff --git a/finance/app/templates/szenarien.html b/finance/app/templates/szenarien.html
index cee2f10..5afedb7 100644
--- a/finance/app/templates/szenarien.html
+++ b/finance/app/templates/szenarien.html
@@ -14,7 +14,7 @@
· Einmalposten: {{ 'ja' if sc.include_planned else 'nein' }}
diff --git a/finance/tests/test_gui.py b/finance/tests/test_gui.py
index d197692..c284ae9 100644
--- a/finance/tests/test_gui.py
+++ b/finance/tests/test_gui.py
@@ -486,14 +486,41 @@ def test_grafana_links_fallback_to_host_port_when_unset(client, monkeypatch):
def test_szenarien_seite_hat_loeschen_button(client, db):
+ from html.parser import HTMLParser
+
client.post("/login", data={"username": "admin", "password": "geheim"})
sc = Scenario(name="Wegwerf", description="", include_recurring=True,
include_planned=True)
db.add(sc)
db.commit()
r = client.get("/szenarien")
+
+ # Verify delete button is present
assert f'hx-delete="/api/scenarios/{sc.id}"' in r.text
- assert 'Szenario „Wegwerf" mit allen Einträgen wirklich löschen?' in r.text
+ # Verify the full confirmation text in the page (brief requirement)
+ assert 'Szenario „Wegwerf” mit allen Einträgen wirklich löschen?' in r.text
+
+ # Parse HTML to verify the hx-confirm attribute has correct value with proper quotes
+ class ButtonParser(HTMLParser):
+ def __init__(self):
+ super().__init__()
+ self.hx_confirm_value = None
+ self.found_delete_button = False
+
+ def handle_starttag(self, tag, attrs):
+ if tag == "button":
+ attrs_dict = dict(attrs)
+ if attrs_dict.get("hx-delete") == f"/api/scenarios/{sc.id}":
+ self.found_delete_button = True
+ self.hx_confirm_value = attrs_dict.get("hx-confirm")
+
+ parser = ButtonParser()
+ parser.feed(r.text)
+ assert parser.found_delete_button, "Delete button not found"
+ # Verify the attribute value uses correct typographic quotes
+ expected_confirm = 'Szenario „Wegwerf” mit allen Einträgen wirklich löschen?'
+ assert parser.hx_confirm_value == expected_confirm, \
+ f"hx-confirm attribute mismatch: got {repr(parser.hx_confirm_value)}, expected {repr(expected_confirm)}"
def test_szenario_loeschen_roundtrip_gui(client, db):