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 { DownloadIcon } from '@patternfly/react-icons';
import ResponseActionButton from './ResponseActionButton';
describe('ResponseActionButton', () => {
    it('renders aria-label correctly if not clicked', () => {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded" }));
        expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
    });
    it('renders aria-label correctly if clicked', () => {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded", isClicked: true }));
        expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
    });
    it('renders tooltip correctly if not clicked', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded" }));
        expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
        // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
        yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
        expect(screen.getByRole('tooltip', { name: 'Download' })).toBeTruthy();
    }));
    it('renders tooltip correctly if clicked', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded", isClicked: true }));
        expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
        // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
        yield userEvent.click(screen.getByRole('button', { name: 'Downloaded' }));
        expect(screen.getByRole('tooltip', { name: 'Downloaded' })).toBeTruthy();
    }));
    it('if clicked variant for tooltip is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", isClicked: true }));
        // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
        yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
        expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
    }));
    it('if clicked variant for aria label is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", isClicked: true }));
        expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
    }));
});
