"""Teste PRD 5.5 — uniformizare UI: US-001 (Acasa fara Ajutor), US-002 (Nomenclator grila standard), US-003 (macro autosend compact). Stories de template/macro -> render direct Jinja pentru US-002/003; US-001 prin TestClient pe fragmentul Acasa. """ from __future__ import annotations import os import re import tempfile from pathlib import Path import pytest from jinja2 import Environment, FileSystemLoader from starlette.testclient import TestClient _TEMPLATES = Path(__file__).resolve().parents[1] / "app" / "web" / "templates" def _env(): return Environment(loader=FileSystemLoader(str(_TEMPLATES)), autoescape=True) # ============================================================ # US-002: Nomenclator ca tabel standard (grila Trimiteri) # ============================================================ def test_nomenclator_grila_standard_cu_randuri(): tmpl = _env().get_template("_nomenclator.html") html = tmpl.render(rows=[ {"cod_prestatie": "A012", "nume_prestatie": "Revizie tehnica", "updated_at": "2026-06-20"}, ]) assert "tablewrap" in html assert ") eliminata assert "ajutor-mapari" not in html # antet de coloana compact assert ">In coada<" in html # proza inline veche eliminata de pe sectiuni assert "sugestia fuzzy e preselectata) si salveaza" not in html assert "Maparile operatie -> cod RAR retinute pentru contul tau" not in html def test_mapari_comutator_compact_in_tabel(client): acct = _login(client) _seed_needs_mapping(acct) html = client.get("/_fragments/mapari").text assert 'name="auto_send"' in html assert "Manual" in html and "Auto" in html