// EmptyChildState 组件单测
// 依据：02-architecture-design.md §15.3 EmptyChildState 设计
// 覆盖：渲染消息和图标 / 无子女绑定提示文案

import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { EmptyChildState } from "./EmptyChildState";

describe("EmptyChildState", () => {
  it("渲染未绑定子女标题", () => {
    render(<EmptyChildState />);
    expect(screen.getByText("尚未绑定子女")).toBeInTheDocument();
  });

  it("渲染联系学校管理员的提示文案", () => {
    render(<EmptyChildState />);
    expect(
      screen.getByText("请联系学校管理员绑定子女信息"),
    ).toBeInTheDocument();
  });

  it("渲染 SVG 图标（aria-hidden）", () => {
    const { container } = render(<EmptyChildState />);
    const svg = container.querySelector("svg");
    expect(svg).not.toBeNull();
    expect(svg).toHaveAttribute("aria-hidden", "true");
  });

  it("使用 heading 层级 h2", () => {
    render(<EmptyChildState />);
    const heading = screen.getByRole("heading", { level: 2 });
    expect(heading).toHaveTextContent("尚未绑定子女");
  });

  it("默认导出与具名导出一致", async () => {
    const mod = await import("./EmptyChildState");
    expect(mod.default).toBe(EmptyChildState);
  });
});
