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 JumpButton from './JumpButton';
import userEvent from '@testing-library/user-event';
describe('JumpButton', () => {
    it('should render top button correctly', () => {
        render(_jsx(JumpButton, { position: "top", onClick: jest.fn() }));
        expect(screen.getByRole('button', { name: /Back to top/i })).toBeTruthy();
    });
    it('should render bottom button correctly', () => {
        render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn() }));
        expect(screen.getByRole('button', { name: /Back to bottom/i })).toBeTruthy();
    });
    it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
        const spy = jest.fn();
        render(_jsx(JumpButton, { position: "bottom", onClick: spy }));
        yield userEvent.click(screen.getByRole('button', { name: /Back to bottom/i }));
        expect(spy).toHaveBeenCalledTimes(1);
    }));
    it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
        render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
        expect(screen.queryByRole('button', { name: /Back to bottom/i })).toBeFalsy();
    }));
});
