import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";

import { SplashBackground } from "../splash-background";
import { SplashButton } from "../splash-button";
import { SplashContent } from "../splash-content";
import { SplashLogo } from "../splash-logo";

describe("splash Tailwind components", () => {
  it("renders SplashLogo with Tailwind wrapper and image classes", () => {
    const html = renderToStaticMarkup(<SplashLogo />);

    expect(html).toContain("z-2");
    expect(html).toContain("inline-flex");
    expect(html).toContain("block h-auto w-auto");
    expect(html).toContain("%2Fimages%2Fsplash%2Fic-logo-home.png");
  });

  it("renders SplashBackground with Tailwind fill image classes", () => {
    const html = renderToStaticMarkup(<SplashBackground />);

    expect(html).toContain("absolute");
    expect(html).toContain("bg-sidebar-background");
    expect(html).toContain("object-cover");
    expect(html).toContain("%2Fimages%2Fsplash%2Fpic-bg-home.png");
  });

  it("renders SplashContent with Tailwind typography classes", () => {
    const html = renderToStaticMarkup(<SplashContent />);

    expect(html).toContain("flex flex-col gap-md");
    expect(html).toContain("font-(family-name:--font-athelas)");
    expect(html).toContain("whitespace-pre-line");
    expect(html).toContain("Welcome to my secret hideout");
  });

  it("renders SplashButton as an always-ready action", () => {
    const html = renderToStaticMarkup(
      <SplashButton onStartChat={() => undefined} />,
    );

    expect(html).toContain("z-2");
    expect(html).toContain("max-w-120");
    expect(html).toContain("bg-[linear-gradient(to_right");
    expect(html).toContain("active:enabled:scale-96");
    expect(html).toContain("active:enabled:brightness-90");
    expect(html).toContain("touch-manipulation");
    expect(html).toContain("Start Chatting");
    expect(html).not.toContain("disabled=\"");
    expect(html).not.toContain("animate-spin");
  });
});
