import * as React from "react"; import { render, screen } from "@testing-library/react"; import { CarouselItem } from "./CarouselItem"; import { CarouselContext } from "./CarouselRoot"; describe("CarouselItem", () => { const renderWithContext = (ui, contextProps) => { return render( {ui} ); }; test("renders visibly into the document", () => { render(Test); expect(screen.getByText("Test")).toBeVisible(); }); test("sets width based on items per page", () => { renderWithContext(Test, { itemsPerPage: 2, totalPages: 1, }); // eslint-disable-next-line jest-dom/prefer-to-have-class expect(screen.getByText("Test")).toHaveAttribute( "class", expect.stringContaining("wpds") ); }); });