"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const react_1 = __importDefault(require("react"));
const react_2 = require("@testing-library/react");
const TwoHandleRange_1 = require("../TwoHandleRange");
require("@testing-library/jest-dom/extend-expect");
const TwoHandleRange_2 = require("../TwoHandleRange");
describe('TwoHandleRange component', () => {
    describe('stepping()', () => {
        it('rounds to ten based steps', () => {
            expect((0, TwoHandleRange_2.stepping)(4, 10)).toBe(0);
            expect((0, TwoHandleRange_2.stepping)(15, 10)).toBe(20);
            expect((0, TwoHandleRange_2.stepping)(99, 10)).toBe(100);
        });
    });
    it('fires event when changed', () => {
        const onChange = vitest_1.vi.fn();
        (0, react_2.render)(react_1.default.createElement(TwoHandleRange_1.TwoHandleRange, { min: 0, max: 100, step: 10, value: [0, 20], onChange: onChange }));
        const ranges = react_2.screen.queryAllByRole('slider');
        react_2.fireEvent.focus(ranges[0]);
        react_2.fireEvent.keyDown(ranges[0], { key: 'ArrowRight', code: 'ArrowRight' });
        react_2.fireEvent.focus(ranges[1]);
        react_2.fireEvent.keyDown(ranges[1], { key: 'ArrowRight', code: 'ArrowRight' });
        expect(onChange).toHaveBeenCalledTimes(2);
    });
});
