fix(5.10): logo ROMFAST in stanga header (ca romfast.ro) + tooltip tema doar numele temei
- US-012c: logo .brand-logo mutat in header-left (32px, aliniat stanga); env badge mutat sub titlu in header-center; titlul ramane centrat; responsiv pastrat. - US-014b: title-ul butonului de tema = doar numele temei curente (Light/Dark/Petrol/Auto), fara enumerarea ciclului; aria-label informativ + aria-live pastrate (a11y). Regresie 896 passed, 1 skipped, 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
"""Teste US-012 / US-012b (PRD 5.10): Header logo ROMFAST + titlu centrat.
|
||||
"""Teste US-012 / US-012b / US-012c (PRD 5.10): Header logo ROMFAST + titlu centrat.
|
||||
|
||||
TDD: testele se scriu INAINTE de implementare (RED), dupa implementare trec (GREEN).
|
||||
|
||||
US-012b (decizie user): logo-ul PNG real (/static/romfast_logo.png) in loc de wordmark text.
|
||||
US-012b (decizie user): logo PNG real (/static/romfast_logo.png) in loc de wordmark text.
|
||||
US-012c (decizie user): logo mutat din header-center in header-left (brand top-left ca pe romfast.ro).
|
||||
Decizie env badge: mutat in header-center (sub <h1>, mic, color:var(--muted)) — nu suprapune
|
||||
logo-ul si pastreaza centrarea optica a titlului in coloana auto a grilei.
|
||||
|
||||
Testeaza:
|
||||
- test_header_contine_by_romfast: <img src="/static/romfast_logo.png" alt="ROMFAST" class="brand-logo">
|
||||
- test_titlu_centrat: titlul e in structura centrata (grila 3 coloane), controale la dreapta
|
||||
- test_header_contine_by_romfast: img brand-logo in .header-left (NU in header-center)
|
||||
- test_titlu_centrat: titlul e in .header-center (grila 3 coloane), controale la dreapta
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -45,52 +48,78 @@ def _get_style(html: str) -> str:
|
||||
return m.group(1)
|
||||
|
||||
|
||||
def _get_div_content(html: str, cls: str) -> str | None:
|
||||
"""Extrage continutul primului div cu clasa `cls` (non-nested)."""
|
||||
m = re.search(
|
||||
r'<div[^>]+class=["\'][^"\']*' + re.escape(cls) + r'[^"\']*["\'][^>]*>(.*?)</div>',
|
||||
html,
|
||||
re.DOTALL,
|
||||
)
|
||||
return m.group(1) if m else None
|
||||
|
||||
|
||||
# ── test_header_contine_by_romfast ────────────────────────────────────────────
|
||||
|
||||
def test_header_contine_by_romfast(client):
|
||||
"""Header contine logo-ul ROMFAST ca <img> (US-012b: decizie user — PNG real).
|
||||
"""Logo-ul ROMFAST (<img class='brand-logo'>) trebuie sa fie in .header-LEFT (US-012c).
|
||||
|
||||
Decizie user: brand top-left ca pe romfast.ro — logo in prima celula a grilei, nu sub titlu.
|
||||
|
||||
Verifica:
|
||||
- <img src="/static/romfast_logo.png"> prezent in header
|
||||
- Atribut alt non-gol (ex. alt="ROMFAST") pentru accesibilitate
|
||||
- Imaginea are clasa brand-logo (pentru stilizare CSS)
|
||||
- NU mai exista spanurile text .romfast-rom / .romfast-fast (wordmark text inlocuit)
|
||||
- img cu romfast_logo.png SI class brand-logo exista in interiorul .header-left
|
||||
- img cu romfast_logo.png NU exista in interiorul .header-center (a fost mutat)
|
||||
- alt non-gol pe img (accesibilitate)
|
||||
- .header-center NU mai contine clasele .romfast-rom / .romfast-fast (curatenie)
|
||||
"""
|
||||
resp = client.get("/login")
|
||||
assert resp.status_code == 200
|
||||
header = _get_header(resp.text)
|
||||
|
||||
# Gaseste toate tag-urile <img> din header si cauta logo-ul
|
||||
img_tags = re.findall(r'<img[^>]+>', header, re.IGNORECASE)
|
||||
logo_tag = next(
|
||||
(t for t in img_tags if "romfast_logo.png" in t),
|
||||
# Extrage continutul .header-left si .header-center
|
||||
left_content = _get_div_content(header, "header-left")
|
||||
center_content = _get_div_content(header, "header-center")
|
||||
assert left_content is not None, ".header-left lipseste din <header>"
|
||||
assert center_content is not None, ".header-center lipseste din <header>"
|
||||
|
||||
# 1. img cu romfast_logo.png IN .header-left
|
||||
img_tags_left = re.findall(r'<img[^>]+>', left_content, re.IGNORECASE)
|
||||
logo_in_left = next(
|
||||
(t for t in img_tags_left if "romfast_logo.png" in t),
|
||||
None,
|
||||
)
|
||||
|
||||
# 1. <img> cu src="/static/romfast_logo.png" prezent in header
|
||||
assert logo_tag is not None, (
|
||||
"<img> cu 'romfast_logo.png' negasit in header. "
|
||||
"Decizie user (US-012b): logo-ul PNG real trebuie sa apara in header. "
|
||||
f"Header: {header[:500]}"
|
||||
assert logo_in_left is not None, (
|
||||
"<img> cu 'romfast_logo.png' negasit in .header-left. "
|
||||
"US-012c: logo-ul trebuie sa fie in celula STANGA a grilei (brand top-left). "
|
||||
f"Continut .header-left: {left_content[:400]}"
|
||||
)
|
||||
|
||||
# 2. Atribut alt non-gol pe imaginea logo-ului (accesibilitate)
|
||||
alt_match = re.search(r'alt=["\']([^"\']+)["\']', logo_tag, re.IGNORECASE)
|
||||
# 2. img cu romfast_logo.png NU mai e in .header-center
|
||||
img_tags_center = re.findall(r'<img[^>]+>', center_content, re.IGNORECASE)
|
||||
logo_in_center = next(
|
||||
(t for t in img_tags_center if "romfast_logo.png" in t),
|
||||
None,
|
||||
)
|
||||
assert logo_in_center is None, (
|
||||
"<img> cu 'romfast_logo.png' inca e in .header-center — trebuie mutat in .header-left. "
|
||||
f"Continut .header-center: {center_content[:400]}"
|
||||
)
|
||||
|
||||
# 3. alt non-gol pe logo (accesibilitate)
|
||||
alt_match = re.search(r'alt=["\']([^"\']+)["\']', logo_in_left, re.IGNORECASE)
|
||||
assert alt_match and alt_match.group(1).strip(), (
|
||||
"Imaginea logo lipseste atributul alt (sau e gol). "
|
||||
f"Tag gasit: {logo_tag}"
|
||||
"Imaginea logo din .header-left lipseste atributul alt (sau e gol). "
|
||||
f"Tag gasit: {logo_in_left}"
|
||||
)
|
||||
|
||||
# 3. Clasa brand-logo aplicata (pentru controlul inaltimii CSS)
|
||||
assert "brand-logo" in logo_tag, (
|
||||
"class='brand-logo' lipseste de pe <img> logo. "
|
||||
f"Tag gasit: {logo_tag}"
|
||||
# 4. class brand-logo prezent pe img
|
||||
assert "brand-logo" in logo_in_left, (
|
||||
"class='brand-logo' lipseste de pe <img> logo din .header-left. "
|
||||
f"Tag gasit: {logo_in_left}"
|
||||
)
|
||||
|
||||
# 4. Spanurile text (wordmark vechi .romfast-rom / .romfast-fast) NU mai exista
|
||||
# 5. Spanurile text (wordmark vechi) NU exista in header
|
||||
assert "romfast-rom" not in header and "romfast-fast" not in header, (
|
||||
"Clasele .romfast-rom / .romfast-fast (wordmark text) inca prezente in header. "
|
||||
"Trebuie inlocuite complet de <img> logo. "
|
||||
f"Header snippet: {header[:500]}"
|
||||
)
|
||||
|
||||
@@ -104,7 +133,7 @@ def test_titlu_centrat(client):
|
||||
- CSS contine grid-template-columns cu 3 coloane pe header (1fr auto 1fr sau similar)
|
||||
- Header contine un element cu clasa 'header-center' (sau similar) care contine h1
|
||||
- Controalele (button tema-toggle) sunt la dreapta (in header-right sau margin-left:auto)
|
||||
- Badge-ul env e in grila (header-left sau similar), nu flotant
|
||||
- header-left exista (celula stanga a grilei, contine logo dupa US-012c)
|
||||
"""
|
||||
resp = client.get("/login")
|
||||
assert resp.status_code == 200
|
||||
@@ -157,7 +186,7 @@ def test_titlu_centrat(client):
|
||||
f"Continut .header-right: {right_content[:300]}"
|
||||
)
|
||||
|
||||
# 4. Badge-ul env e in header-left (nu mai e aruncat dupa h1)
|
||||
# 4. header-left exista in grila (contine logo dupa US-012c)
|
||||
left_div = re.search(
|
||||
r'<div[^>]+class=["\'][^"\']*header-left[^"\']*["\'][^>]*>(.*?)</div>',
|
||||
header,
|
||||
@@ -165,11 +194,5 @@ def test_titlu_centrat(client):
|
||||
)
|
||||
assert left_div, (
|
||||
"Element cu clasa 'header-left' negasit in <header>. "
|
||||
"Badge-ul env trebuie sa fie in celula stanga a grilei (echilibru optic). "
|
||||
f"Header snippet: {header[:600]}"
|
||||
)
|
||||
left_content = left_div.group(1)
|
||||
assert 'class="env"' in left_content or "class='env'" in left_content, (
|
||||
"Badge-ul .env nu e in .header-left. "
|
||||
f"Continut .header-left: {left_content[:200]}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user