import { render, screen } from "@solidjs/testing-library";
import { describe, expect, it } from "vitest";
import { Alert } from "../../../src/components/alert/index";

describe("Alert", () => {
	it("has role=alert", () => {
		render(() => <Alert>Warning!</Alert>);
		expect(screen.getByRole("alert")).toBeTruthy();
	});
	it("renders children", () => {
		render(() => <Alert>Important message</Alert>);
		expect(screen.getByText("Important message")).toBeTruthy();
	});
	it("spreads props", () => {
		render(() => (
			<Alert data-testid="a" class="custom">
				Text
			</Alert>
		));
		expect(screen.getByTestId("a").getAttribute("class")).toBe("custom");
	});
});
