feat(5.9): US-002 - tabel trimiteri: eticheta umana sub stare, cod RAR simplu, rand->modal
- Sub pill-ul de Stare apare eticheta umana scurta (`eticheta_problema` din US-001), text mic `s-error`, doar cand e ne-goala — stare transmisa prin text, nu doar culoare. - Coloana Operatie linia 2: codul RAR ca chip discret FARA prefixul "cod RAR:"; cand nemapat ramane "nemapat" muted (comportament 5.8 pastrat). - R8: regula touch 44px (min-height + padding) pe `tr.trimitere-row` + afordanta hover/focus; chevron inexistent in cod (randul declanseaza deja modalul din US-003, fara aria-expanded). - Teste: 7 teste noi US-002 + actualizate test_operatie_contine_cod_rar / test_tabel_nu_are_coloana_motiv; suita completa 826 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,7 +125,11 @@ def test_motiv_needs_data_afisat(client):
|
||||
|
||||
|
||||
def test_tabel_nu_are_coloana_motiv(client):
|
||||
"""PRD 5.8 US-007: coloana Motiv eliminata din thead/tbody (e in detaliu)."""
|
||||
"""PRD 5.8 US-007: Motiv nu e o coloana separata in thead/tbody.
|
||||
|
||||
Nota (PRD 5.9 US-002, R1): eticheta umana scurta a problemei apare acum sub pill-ul
|
||||
de Stare ca text mic (NU intr-o coloana proprie) — vezi test_eticheta_umana_apare_sub_pill.
|
||||
"""
|
||||
acct = _create_account_user("nomotiv@test.com")
|
||||
_insert_submission(
|
||||
acct, "needs_data",
|
||||
@@ -136,12 +140,12 @@ def test_tabel_nu_are_coloana_motiv(client):
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "<th>Motiv</th>" not in html
|
||||
# continutul Motiv nu mai apare in tabel (a fost mutat in detaliu)
|
||||
assert "lipsa odometru xyz" not in html
|
||||
# Motiv nu are coloana/celula dedicata (label-ul scurt sta sub pill in col-stare)
|
||||
assert 'data-eticheta="Motiv"' not in html
|
||||
|
||||
|
||||
def test_operatie_contine_cod_rar(client):
|
||||
"""PRD 5.8 US-007: coloana Operatie arata 'cod RAR: XXX' cand mapat, 'nemapat' cand nu."""
|
||||
"""PRD 5.9 US-002: coloana Operatie arata codul RAR simplu (FARA prefix) cand mapat, 'nemapat' cand nu."""
|
||||
acct = _create_account_user("codrar@test.com")
|
||||
# mapat: are cod_prestatie -> cod RAR vizibil
|
||||
_insert_submission(acct, "sent", payload={
|
||||
@@ -163,7 +167,9 @@ def test_operatie_contine_cod_rar(client):
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "cod RAR: OE-2" in html
|
||||
# US-002: codul ramane, dar prefixul textual "cod RAR:" a fost eliminat (R8)
|
||||
assert "OE-2" in html
|
||||
assert "cod RAR:" not in html
|
||||
assert "nemapat" in html
|
||||
|
||||
|
||||
@@ -195,6 +201,120 @@ def test_detaliu_trimitere(client):
|
||||
assert "99001" in html # nr prezentare RAR
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# US-002 (PRD 5.9): tabel trimiteri — eticheta umana sub pill, fara chevron,
|
||||
# cod RAR simplu (fara prefix), randul declanseaza modalul. Teste de randare.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_eticheta_umana_apare_sub_pill(client):
|
||||
"""Sub pill-ul de Stare apare eticheta umana scurta (text), nu codul brut."""
|
||||
acct = _create_account_user("ets@test.com")
|
||||
_insert_submission(
|
||||
acct, "needs_data",
|
||||
rar_error=json.dumps([{"field": "odometru_final", "message": "lipsa odometru"}]),
|
||||
)
|
||||
_login(client, "ets@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "eticheta-problema" in html # containerul textului uman sub pill
|
||||
assert "s-error" in html # colorat ca problema (error/needs_*)
|
||||
# NU randeaza cod brut de catalog pe rand
|
||||
assert "COD_" not in html
|
||||
assert "RAR_EROARE" not in html
|
||||
|
||||
|
||||
def test_eticheta_umana_absenta_pe_rand_ok(client):
|
||||
"""Pe randuri fara problema (sent) nu apare eticheta-problema (string gol -> nimic)."""
|
||||
acct = _create_account_user("etok@test.com")
|
||||
_insert_submission(acct, "sent", id_prezentare=70123)
|
||||
_login(client, "etok@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
assert "eticheta-problema" not in resp.text
|
||||
|
||||
|
||||
def test_fara_chevron_in_rand(client):
|
||||
"""R8: niciun chevron in coloana # / pe rand (eliminat impreuna cu CSS/JS asociat)."""
|
||||
acct = _create_account_user("chev@test.com")
|
||||
_insert_submission(acct, "sent")
|
||||
_login(client, "chev@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
assert "chevron" not in resp.text
|
||||
|
||||
|
||||
def test_cod_rar_fara_prefix_text(client):
|
||||
"""Coloana Operatie linia 2: doar codul RAR (ex. OE-2), FARA prefixul 'cod RAR:'."""
|
||||
acct = _create_account_user("crp@test.com")
|
||||
_insert_submission(acct, "sent", payload={
|
||||
"vin": "WVWZZZ1JZXW000111",
|
||||
"nr_inmatriculare": "B111AAA",
|
||||
"data_prestatie": "2026-06-18",
|
||||
"odometru_final": "10000",
|
||||
"prestatii": [{"cod_prestatie": "OE-2", "denumire": "Verificare X"}],
|
||||
})
|
||||
_login(client, "crp@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "OE-2" in html # codul ramane vizibil
|
||||
assert "cod RAR:" not in html # prefixul textual a disparut
|
||||
|
||||
|
||||
def test_cod_rar_nemapat_muted(client):
|
||||
"""Cand nemapat, linia 2 arata 'nemapat' muted (comportament 5.8 pastrat)."""
|
||||
acct = _create_account_user("crn@test.com")
|
||||
_insert_submission(acct, "needs_mapping", payload={
|
||||
"vin": "WVWZZZ1JZXW000222",
|
||||
"nr_inmatriculare": "B222BBB",
|
||||
"data_prestatie": "2026-06-18",
|
||||
"odometru_final": "20000",
|
||||
"prestatii": [{"cod_op_service": "INTERN9", "denumire": "Spalare auto"}],
|
||||
})
|
||||
_login(client, "crn@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
assert "nemapat" in resp.text
|
||||
|
||||
|
||||
def test_rand_deschide_modal(client):
|
||||
"""Randul tinteste corpul modalului (#detaliu-modal-body), NU un rand-sibling (US-003)."""
|
||||
acct = _create_account_user("mod@test.com")
|
||||
sid = _insert_submission(acct, "sent")
|
||||
_login(client, "mod@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert f'hx-get="/_fragments/trimitere/{sid}"' in html
|
||||
assert 'hx-target="#detaliu-modal-body"' in html
|
||||
# randul-sibling de detaliu din 5.8 a fost eliminat
|
||||
assert "detaliu-rand" not in html
|
||||
|
||||
|
||||
def test_rand_a11y_si_keyboard_markup(client):
|
||||
"""R8 a11y: rand role=button, tabindex=0, aria-haspopup=dialog, FARA aria-expanded.
|
||||
|
||||
Limitare: deschiderea efectiva pe Enter/Space si readucerea focusului pe Esc sunt
|
||||
gestionate de JS in base.html (keydown delegat), netestabile in TestClient (fara DOM).
|
||||
Verificam markup-ul/atributele care le activeaza + prezenta handler-elor de tastatura.
|
||||
"""
|
||||
acct = _create_account_user("kbd@test.com")
|
||||
_insert_submission(acct, "sent")
|
||||
_login(client, "kbd@test.com")
|
||||
resp = client.get("/_fragments/submissions")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert 'role="button"' in html
|
||||
assert 'tabindex="0"' in html
|
||||
assert 'aria-haspopup="dialog"' in html
|
||||
assert "aria-expanded" not in html # R8: nu mai e expand/collapse pe rand
|
||||
# Handler-ele de tastatura traiesc in base.html (pagina completa).
|
||||
base = client.get("/?tab=coada").text
|
||||
assert "Enter" in base and "Spacebar" in base # Enter/Space deschid modalul
|
||||
assert "Escape" in base # Esc inchide + readuce focusul
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# US-001 (R1): eticheta umana scurta a problemei pe randul de tabel.
|
||||
# Teste pure pe _submission_row_view — randarea sub pill e US-002.
|
||||
|
||||
Reference in New Issue
Block a user