"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 react_1 = __importDefault(require("react"));
const react_2 = require("@testing-library/react");
require("@testing-library/jest-dom");
const JumpButton_1 = __importDefault(require("./JumpButton"));
const user_event_1 = __importDefault(require("@testing-library/user-event"));
describe('JumpButton', () => {
    it('should render top button correctly', () => {
        (0, react_2.render)(react_1.default.createElement(JumpButton_1.default, { position: "top", onClick: jest.fn() }));
        expect(react_2.screen.getByRole('button', { name: /Jump top/i })).toBeTruthy();
    });
    it('should render bottom button correctly', () => {
        (0, react_2.render)(react_1.default.createElement(JumpButton_1.default, { position: "bottom", onClick: jest.fn() }));
        expect(react_2.screen.getByRole('button', { name: /Jump bottom/i })).toBeTruthy();
    });
    it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        (0, react_2.render)(react_1.default.createElement(JumpButton_1.default, { position: "bottom", onClick: spy }));
        yield user_event_1.default.click(react_2.screen.getByRole('button', { name: /Jump bottom/i }));
        expect(spy).toHaveBeenCalledTimes(1);
    }));
    it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
        (0, react_2.render)(react_1.default.createElement(JumpButton_1.default, { position: "bottom", onClick: jest.fn(), isHidden: true }));
        expect(react_2.screen.queryByRole('button', { name: /Jump bottom/i })).toBeFalsy();
    }));
});
