"use strict";
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());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("@testing-library/react");
require("@testing-library/jest-dom");
const user_event_1 = __importDefault(require("@testing-library/user-event"));
const react_icons_1 = require("@patternfly/react-icons");
const ResponseActionButton_1 = __importDefault(require("./ResponseActionButton"));
describe('ResponseActionButton', () => {
    it('renders aria-label correctly if not clicked', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded" }));
        expect(react_1.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
    });
    it('renders aria-label correctly if clicked', () => {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded", isClicked: true }));
        expect(react_1.screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
    });
    it('renders tooltip correctly if not clicked', () => __awaiter(void 0, void 0, void 0, function* () {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded" }));
        expect(react_1.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 user_event_1.default.click(react_1.screen.getByRole('button', { name: 'Download' }));
        expect(react_1.screen.getByRole('tooltip', { name: 'Download' })).toBeTruthy();
    }));
    it('renders tooltip correctly if clicked', () => __awaiter(void 0, void 0, void 0, function* () {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded", isClicked: true }));
        expect(react_1.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 user_event_1.default.click(react_1.screen.getByRole('button', { name: 'Downloaded' }));
        expect(react_1.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* () {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.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 user_event_1.default.click(react_1.screen.getByRole('button', { name: 'Download' }));
        expect(react_1.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* () {
        (0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionButton_1.default, { icon: (0, jsx_runtime_1.jsx)(react_icons_1.DownloadIcon, {}), ariaLabel: "Download", isClicked: true }));
        expect(react_1.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
    }));
});
