var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { jsx as _jsx } from "react/jsx-runtime";
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import userEvent from '@testing-library/user-event';
import ChatbotToggle from './ChatbotToggle';
describe('ChatbotToggle', () => {
    it('should render tooltipLabel correctly', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Tooltip" }));
        yield userEvent.click(screen.getByRole('button', { name: /Tooltip toggle/i }));
        expect(screen.getByRole('tooltip', { name: /Tooltip/i })).toBeTruthy();
    }));
    it('should render toggleButtonLabel correctly', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", toggleButtonLabel: "Button" }));
        expect(screen.getByRole('button', { name: /Button/i })).toBeTruthy();
    }));
    it('should call onToggleChatbot when clicked', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", onToggleChatbot: spy }));
        yield userEvent.click(screen.getByRole('button'));
        expect(spy).toHaveBeenCalledTimes(1);
    }));
    it('should handle isChatbotVisible correctly when true', () => {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isChatbotVisible: true, openIconTestId: "Open" }));
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button--active');
        expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
        expect(screen.getByTestId('Open')).toBeTruthy();
    });
    it('should handle isChatbotVisible correctly when false', () => {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isChatbotVisible: false, openIconTestId: "Open" }));
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
        expect(screen.getByRole('button')).not.toHaveClass('pf-chatbot__button--active');
        expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'false');
        expect(screen.queryByTestId('Open')).toBeFalsy();
    });
    it('should handle isRound correctly', () => {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isRound: true }));
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button--round');
    });
    it('should handle className correctly', () => {
        render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", className: "test" }));
        expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
        expect(screen.getByRole('button')).toHaveClass('test');
    });
});
