- NEVO dataset (2328 voedingsmiddelen) met zoekfunctie - Dagboek met eetmomenten, koolhydratenlimiet en progress bar - Maaltijden opslaan + nesten in dagboek + eenmalig/permanent bewerken - Portie-systeem met steppers per NEVO-categorie - Vorteq amber/goud branding met Karby logo - Voedingscentrum links per product - 8 Playwright e2e tests (100% groen) - PWA met offline support Kanban board: koolhydraat-app
70 lines
2 KiB
Python
70 lines
2 KiB
Python
#!/usr/bin/env python3
|
|
"""Ad-hoc verification: contrast audit fix checker for koolhydraat-app."""
|
|
import re, sys
|
|
|
|
FILES = [
|
|
"/Users/cas/projects/koolhydraat-app/index.html",
|
|
"/Users/cas/projects/koolhydraat-app/docker/index.html",
|
|
]
|
|
|
|
REQUIRED_SELECTORS = [
|
|
".food-item-kh",
|
|
".eetmoment-kh",
|
|
".eetmoment-item-kh",
|
|
".total-carb-value",
|
|
".detail-kh-number",
|
|
".portion-preview-value",
|
|
".detail-info-link",
|
|
]
|
|
|
|
errors = []
|
|
files_checked = 0
|
|
fixes_found = 0
|
|
|
|
for fp in FILES:
|
|
try:
|
|
text = open(fp, "r", encoding="utf-8").read()
|
|
except FileNotFoundError:
|
|
errors.append(f"MISSING: {fp}")
|
|
continue
|
|
files_checked += 1
|
|
|
|
lines = text.split("\n")
|
|
for i, line in enumerate(lines, 1):
|
|
stripped = line.strip()
|
|
if re.search(r"(?<!border-)color:\s*var\(--accent\)", stripped):
|
|
errors.append(f"BANNED in {fp}:{i}: {stripped}")
|
|
if re.search(r"color:\s*var\(--primary\)$", stripped):
|
|
errors.append(f"BANNED in {fp}:{i}: {stripped}")
|
|
|
|
for sel in REQUIRED_SELECTORS:
|
|
idx = text.find(sel)
|
|
if idx >= 0:
|
|
chunk = text[idx:idx+300]
|
|
if "color: var(--primary-dark)" in chunk:
|
|
fixes_found += 1
|
|
else:
|
|
errors.append(f"MISSING FIX: {sel} in {fp}")
|
|
|
|
if errors:
|
|
print("VERIFICATION FAILED")
|
|
for e in errors:
|
|
print(f" \u2717 {e}")
|
|
sys.exit(1)
|
|
else:
|
|
print("VERIFICATION PASSED")
|
|
print(f" Files checked: {files_checked}")
|
|
print(f" Fixes confirmed: {fixes_found}")
|
|
expected = len(REQUIRED_SELECTORS) * files_checked
|
|
print(f" Expected fixes: {expected}")
|
|
print(f" All contrast fixes applied to both files \u2713")
|
|
|
|
print()
|
|
print("--- CSS Variables ---")
|
|
for fp in FILES:
|
|
text = open(fp, "r", encoding="utf-8").read()
|
|
for var in ["--primary-dark", "--primary", "--accent"]:
|
|
m = re.search(rf"{var}:\s*(#[0-9A-Fa-f]+)", text)
|
|
if m:
|
|
label = fp.split("/")[-1]
|
|
print(f" {label}: {var} = {m.group(1)}")
|