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 userEvent from '@testing-library/user-event';
import '@testing-library/jest-dom';
import QuickResponse from './QuickResponse';
test('Renders with quick responses', () => {
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' },
        { id: '3', content: 'Response 3' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    expect(screen.getByText('Response 1')).toBeVisible();
    expect(screen.getByText('Response 2')).toBeVisible();
    expect(screen.getByText('Response 3')).toBeVisible();
});
test('Renders with compact styling', () => {
    const quickResponses = [{ id: '1', content: 'Compact response' }];
    render(_jsx(QuickResponse, { quickResponses: quickResponses, isCompact: true }));
    expect(screen.getByText('Compact response').closest('.pf-v6-c-label')).toHaveClass('pf-m-compact');
});
test('Renders with custom className on response', () => {
    const quickResponses = [{ id: '1', content: 'Custom class response', className: 'custom-response-class' }];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    expect(screen.getByText('Custom class response').closest('.pf-v6-c-label')).toHaveClass('custom-response-class');
});
test('Renders with custom container className', () => {
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { className: 'custom-container-class' } }));
    expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group')).toHaveClass('custom-container-class');
});
test('Spreads additional custom container props', () => {
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { id: 'custom-container-id' } }));
    expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group__list')).toHaveAttribute('id', 'custom-container-id');
});
test('Renders with pf-chatbot__message-quick-response--selected class after click', () => __awaiter(void 0, void 0, void 0, function* () {
    const user = userEvent.setup();
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    yield user.click(screen.getByText('Response 1'));
    expect(screen.getByText('Response 1').closest('.pf-v6-c-label')).toHaveClass('pf-chatbot__message-quick-response--selected');
}));
test('Does not calls onClick handler when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
    const user = userEvent.setup();
    const handleClick = jest.fn();
    const quickResponses = [{ id: '1', content: 'Clickable response' }];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    yield user.click(screen.getByText('Clickable response'));
    expect(handleClick).not.toHaveBeenCalled();
}));
test('Calls onClick handler when passed', () => __awaiter(void 0, void 0, void 0, function* () {
    const user = userEvent.setup();
    const handleClick = jest.fn();
    const quickResponses = [{ id: '1', content: 'Clickable response', onClick: handleClick }];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    yield user.click(screen.getByText('Clickable response'));
    expect(handleClick).toHaveBeenCalled();
}));
test('Does not call onSelect when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
    const user = userEvent.setup();
    const handleSelect = jest.fn();
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    yield user.click(screen.getByText('Response 2'));
    expect(handleSelect).not.toHaveBeenCalled();
}));
test('Calls onSelect when passed', () => __awaiter(void 0, void 0, void 0, function* () {
    const user = userEvent.setup();
    const handleSelect = jest.fn();
    const quickResponses = [
        { id: '1', content: 'Response 1' },
        { id: '2', content: 'Response 2' }
    ];
    render(_jsx(QuickResponse, { quickResponses: quickResponses, onSelect: handleSelect }));
    yield user.click(screen.getByText('Response 2'));
    expect(handleSelect).toHaveBeenCalledWith('2');
}));
test('Spreads additional response props', () => {
    const quickResponses = [{ id: '1', content: 'Response with props', isCompact: true, 'aria-label': 'Test label' }];
    render(_jsx(QuickResponse, { quickResponses: quickResponses }));
    expect(screen.getByText('Response with props').closest('.pf-v6-c-label')).toHaveAttribute('aria-label', 'Test label');
});
