from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
JS = (ROOT / "ui_builder" / "static" / "app.js").read_text(encoding="utf-8")
CSS = (ROOT / "ui_builder" / "static" / "styles.css").read_text(encoding="utf-8")
HTML = (ROOT / "ui_builder" / "static" / "index.html").read_text(encoding="utf-8")
SERVICE = (ROOT / "hockey_data" / "service.py").read_text(encoding="utf-8")
ROUTER = (ROOT / "hockey_data" / "router.py").read_text(encoding="utf-8")
MODULE_JS = (ROOT / "hockey_data" / "static" / "tournament-menu.js").read_text(encoding="utf-8")

def test_runtime_bell_controls_toasts_only():
    assert "operatorToastsEnabled: true" in JS
    assert "runtimeSession && !error && !force && state.operatorToastsEnabled === false" in JS
    assert "Automatic triggers always remain active" in JS
    assert "🔔 Toast: ВКЛ" in JS
    assert "Toast-уведомления включены" in JS
    assert "toasts_enabled" in SERVICE
    assert '"triggers_enabled": True' in SERVICE
    assert '@router.put("/preferences/toasts")' in ROUTER
    assert "HOCKEY_RUNTIME_TOASTS_ENABLED" in JS
    assert "HOCKEY_RUNTIME_TOASTS_ENABLED === false" in MODULE_JS
    assert "🔔" in HTML

def test_runtime_can_grow_in_f11_and_large_viewports():
    assert "const maxScale = fixedHockeyCanvas ? 1.6 : 1.8;" in JS
    assert "BUILD59 — account toast switch + denser adaptive runtime/F11 workspace" in CSS
    assert "@media (min-width: 1900px) and (min-height: 1000px)" in CSS
    assert ".runtime-viewport" in CSS
    assert "max-width: none !important" in CSS
