import {
cleanup,
render,
screen,
} from "@testing-library/react";
import assert from "node:assert";
import {
afterEach,
describe,
test,
} from "node:test";
import { Modal } from "./index";
describe("Modal", () => {
afterEach(() => {
cleanup();
});
test("renders modal wrapper by id", () => {
const { container } = render(
Modal content
);
const modal = container.querySelector("#main-modal");
assert.notStrictEqual(modal, null);
assert.strictEqual(modal?.hasAttribute("data-js-modal"), true);
assert.notStrictEqual(screen.queryByText("Modal content"), null);
});
test("renders custom control slot", () => {
render(
Close}
/>
);
assert.notStrictEqual(screen.queryByText("Close"), null);
});
});