import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__ from "@tachybase/test/client";
import * as __WEBPACK_EXTERNAL_MODULE__demos_addonBefore_addonAfter_mjs__ from "../demos/addonBefore&addonAfter.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_highPrecisionDecimals_mjs__ from "../demos/highPrecisionDecimals.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_inputNumber_mjs__ from "../demos/inputNumber.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__ from "../ReadPretty.mjs";
describe('InputNumber', ()=>{
    it('should display the title', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_inputNumber_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Editable').innerHTML).toBe('Editable');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Read pretty').innerHTML).toBe('Read pretty');
    });
    it('should display the value of user input', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_inputNumber_mjs__["default"], {}));
        const input = container.querySelector('input');
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: 1
            }
        });
        expect(input.value).toBe('1');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('1')).toBeInTheDocument();
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: ''
            }
        });
        expect(input.value).toBe('');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.queryByText('NaN')).toBeNull();
    });
});
describe('InputNumber: addonBefore/addonAfter', ()=>{
    it('should display the title', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_addonBefore_addonAfter_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Editable').innerHTML).toBe('Editable');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Read pretty').innerHTML).toBe('Read pretty');
    });
    it('should display the value of user input', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_addonBefore_addonAfter_mjs__["default"], {}));
        const input = container.querySelector('input');
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: 1
            }
        });
        expect(input.value).toBe('1');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('¥')).toBeInTheDocument();
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: ''
            }
        });
        expect(input.value).toBe('');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.queryByText('NaN')).toBeNull();
    });
});
describe('InputNumber: High precision decimals', ()=>{
    it('should display the title', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_highPrecisionDecimals_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Editable').innerHTML).toBe('Editable');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Read pretty').innerHTML).toBe('Read pretty');
    });
    it('should display the value of user input', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_highPrecisionDecimals_mjs__["default"], {}));
        const input = container.querySelector('input');
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: 1
            }
        });
        expect(input.value).toBe('1.00');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('1.00')).toBeInTheDocument();
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.change(input, {
            target: {
                value: ''
            }
        });
        expect(input.value).toBe('');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.queryByText('NaN')).toBeNull();
    });
});
describe('ReadPretty:formatNumberWithSeparator', ()=>{
    test('Format number with default separator', ()=>{
        const formatted = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.formatNumberWithSeparator)(1234567.89);
        expect(formatted).toBe('1234567.9');
    });
    test('Format number with custom separator', ()=>{
        const formatted = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.formatNumberWithSeparator)(1234567.89, '0,0.00', 1);
        expect(formatted).toBe('1,234,567.9');
    });
});
describe('ReadPretty:formatUnitConversion', ()=>{
    test('Multiply value by 2', ()=>{
        const result = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.formatUnitConversion)(10, '*', 2);
        expect(result).toBe(20);
    });
    test('Divide value by zero', ()=>{
        const result = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.formatUnitConversion)(10, '/', 0);
        expect(result).toBe(10);
    });
    test('0.1*0.2', ()=>{
        const result = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.formatUnitConversion)(0.1, '*', 0.2);
        expect(result).toBe(0.02);
    });
});
describe('ReadPretty:scientificNotation', ()=>{
    test('Format number into scientific notation', ()=>{
        const formatted = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.scientificNotation)(1234567.89, 2);
        expect(formatted).toBe('1.23×10<sup>6</sup>');
    });
    test('Format number into scientific notation with custom separator', ()=>{
        const formatted = (0, __WEBPACK_EXTERNAL_MODULE__ReadPretty_mjs__.scientificNotation)(1234567.89, 2, '.');
        expect(formatted).toBe('1.23×10<sup>6</sup>');
    });
});
