from pathlib import Path


def test_game_team_state_controls_are_prominent_icon_buttons():
    js = Path("ui_builder/static/app.js").read_text(encoding="utf-8")
    css = Path("ui_builder/static/styles.css").read_text(encoding="utf-8")

    assert "function hockeyTeamStateButtonPresentation" in js
    assert "function hockeyTeamStateButtonMarkup" in js
    assert 'data-hockey-team-flag' in js
    assert 'data-tooltip=' in js
    assert 'aria-pressed=' in js
    assert 'hpd-team-state-icon' in js
    assert 'hpd-team-state-copy' in js
    assert '.hpd-team-state-btn.is-active .hpd-team-state-led' in css
    assert 'min-width: 132px' in css


def test_prematch_runtime_uses_internal_scroll_for_many_buttons():
    css = Path("ui_builder/static/styles.css").read_text(encoding="utf-8")

    panel_start = css.index(".hockey-prematch-panel {")
    panel_end = css.index("}", panel_start)
    panel = css[panel_start:panel_end]
    assert "grid-template-rows: auto minmax(0,1fr)" in panel
    assert "overflow: hidden" in panel

    groups_start = css.index(".hockey-prematch-groups {")
    groups_end = css.index("}", groups_start)
    groups = css[groups_start:groups_end]
    assert "overflow-y: auto" in groups
    assert "scrollbar-gutter: stable" in groups
    assert ".hockey-prematch-groups::-webkit-scrollbar" in css
