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 { SendButton } from './SendButton';
const renderSend = (props) => {
    const spy = jest.fn();
    render(_jsx(SendButton, Object.assign({ onClick: spy }, props)));
};
describe('Send button', () => {
    it('should render button correctly', () => {
        renderSend();
        expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
    });
    it('should handle onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        render(_jsx(SendButton, { onClick: spy }));
        yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
        expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
        expect(spy).toHaveBeenCalledTimes(1);
    }));
    it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(SendButton, { onClick: jest.fn, tooltipContent: "Test" }));
        yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
        expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
    }));
    it('should handle className prop', () => {
        renderSend({ className: 'test' });
        expect(screen.getByRole('button', { name: 'Send' })).toHaveClass('test');
    });
    it('should handle spread props, including aria-label', () => {
        renderSend({ 'aria-label': 'test' });
        expect(screen.getByRole('button', { name: 'test' }));
    });
    it('should handle tooltipProps prop', () => __awaiter(void 0, void 0, void 0, function* () {
        renderSend({ tooltipProps: { id: 'test' } });
        yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
        expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
    }));
    it('should handle isCompact', () => {
        renderSend({ 'data-testid': 'button', isCompact: true });
        expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
    });
});
