/**
 * Control-bar auto-hide rule (DR-189).
 *
 * TRACES: UR-003, UR-066 | DR-189 | UT-188
 */

import { describe, it, expect } from "vitest";
import { shouldHideControls } from "./controlsVisibility";

const playing = { isPlaying: true, isSeeking: false, menuOpen: false };

describe("shouldHideControls", () => {
  it("hides the bar during uninterrupted playback", () => {
    expect(shouldHideControls(playing)).toBe(true);
  });

  it("keeps the bar while paused", () => {
    // A user who paused by tapping the surface has no other way back.
    expect(shouldHideControls({ ...playing, isPlaying: false })).toBe(false);
  });

  it("keeps the bar while seeking", () => {
    // The position readout is the point of the bar mid-seek.
    expect(shouldHideControls({ ...playing, isSeeking: true })).toBe(false);
  });

  it("keeps the bar while a menu is open", () => {
    // The menus are anchored to the bar; hiding it takes the open menu with it.
    expect(shouldHideControls({ ...playing, menuOpen: true })).toBe(false);
  });
});
