from pathlib import Path def test_prematch_buttons_use_authenticated_hockey_endpoint(): app_js = Path("ui_builder/static/app.js").read_text(encoding="utf-8") app_py = Path("app.py").read_text(encoding="utf-8") assert 'fetch("/api/hockey/ui/prematch-buttons"' in app_js assert '"/api/hockey/ui/prematch-buttons"' in app_py assert 'dependencies=[Depends(hockey_auth.require_user)]' in app_py assert 'published_config["prematch_buttons"]' in app_py assert 'const editorApi = "/api/ui-builder"' not in app_js def test_modifier_only_shortcuts_are_distinct_from_longer_chords(): app_js = Path("ui_builder/static/app.js").read_text(encoding="utf-8") assert 'orderedModifiers.length >= 2 ? orderedModifiers.join("+")' in app_js assert 'function modifierOnlyShortcutCombo()' in app_js assert 'modifierShortcutChordUsedKey' in app_js assert 'function handleModifierOnlyShortcutRelease(event)' in app_js assert '"keyboard-modifiers"' in app_js assert 'Ctrl+Shift, Ctrl+Shift+O' in app_js def test_prematch_rows_stay_at_top_and_agent_is_below_modals(): css = Path("ui_builder/static/styles.css").read_text(encoding="utf-8") agent_css = Path("hockey_data/static/agent-devices.css").read_text(encoding="utf-8") assert 'align-content: start;' in css assert 'grid-auto-rows: max-content;' in css assert 'align-self: start;' in css assert 'z-index: 45;' in agent_css assert 'z-index: 10040;' not in agent_css