import { render } from "@testing-library/react";
import { axe } from "vitest-axe";
import { Link } from "../../Link";
import { Alert } from "../";

const example = (
  <Alert
    title="Donec id elit non mi porta gravida at eget metus."
    description="Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Sed posuere consectetur est at lobortis. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit."
    actionButtons={[
      <Link key="button-1" tag="button" type="button">
        Prihlásiť sa
      </Link>,
      <Link key="button-2" tag="button" type="button">
        Skryť
      </Link>,
    ]}
  />
);

it("is valid html", () => {
  const { container } = render(example);
  expect(container).toHTMLValidate();
});

it("is accessible", async () => {
  const { container } = render(example);
  expect(await axe(container)).toHaveNoViolations();
});
