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

describe("Textarea Component", () => {
  it("adds a fallback id for browser autofill diagnostics", () => {
    render(<Textarea aria-label="Description" />);

    expect(screen.getByRole("textbox")).toHaveAttribute("id");
  });

  it("keeps explicit id and name values", () => {
    render(<Textarea id="explicit-textarea" name="explicit-name" />);
    const textarea = screen.getByRole("textbox");

    expect(textarea).toHaveAttribute("id", "explicit-textarea");
    expect(textarea).toHaveAttribute("name", "explicit-name");
  });
});
