import React from "react";
import { render, screen } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import { Slider } from "./index";
// Mock context
const mockUseRootElement = vi.fn();
vi.mock("../context", () => ({
    useRootElement: () => mockUseRootElement(),
}));
describe("Slider", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("renders without crashing", () => {
        mockUseRootElement.mockReturnValue({
            activeScore: "pedestrian_friendly",
            isExpanded: true,
        });
        render(React.createElement(Slider, null));
        expect(screen.getByTestId("slider")).toBeInTheDocument();
    });
    it("renders children when provided", () => {
        mockUseRootElement.mockReturnValue({
            activeScore: "pedestrian_friendly",
            isExpanded: true,
        });
        render(React.createElement(Slider, null,
            React.createElement("div", { "data-testid": "test-child" }, "Test Child")));
        expect(screen.getByTestId("test-child")).toBeInTheDocument();
    });
    it("has isOpen attribute set based on isExpanded and activeScore", () => {
        mockUseRootElement.mockReturnValue({
            activeScore: "pedestrian_friendly",
            isExpanded: true,
        });
        render(React.createElement(Slider, null));
        const slider = screen.getByTestId("slider");
        expect(slider).toHaveAttribute("data-is-open", "true");
    });
    it("does not render if isExpanded is false", () => {
        mockUseRootElement.mockReturnValue({
            activeScore: "pedestrian_friendly",
            isExpanded: false,
        });
        render(React.createElement(Slider, null));
        const slider = screen.getByTestId("slider");
        expect(slider).toHaveAttribute("data-is-open", "false");
    });
});
//# sourceMappingURL=index.test.js.map