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_checkbox_mjs__ from "../demos/checkbox.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_checkbox_group_mjs__ from "../demos/checkbox.group.mjs";
describe('Checkbox', ()=>{
    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_checkbox_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('编辑模式').innerHTML).toBe('编辑模式');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('阅读模式').innerHTML).toBe('阅读模式');
    });
    it('should display the icon when checked', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_checkbox_mjs__["default"], {}));
        const input = container.querySelector('input');
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(input);
        const icon = container.querySelector('svg');
        expect(icon).toMatchInlineSnapshot('\n      <svg\n        aria-hidden="true"\n        data-icon="check"\n        fill="currentColor"\n        focusable="false"\n        height="1em"\n        viewBox="64 64 896 896"\n        width="1em"\n      >\n        <path\n          d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"\n        />\n      </svg>\n    ');
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(input);
        expect(container.querySelector('svg')).toBeNull();
    });
});
describe('Checkbox.Group', ()=>{
    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_checkbox_group_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('编辑模式').innerHTML).toBe('编辑模式');
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('阅读模式').innerHTML).toBe('阅读模式');
    });
    it('should display the tag when checked', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_checkbox_group_mjs__["default"], {}));
        const option1 = __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByLabelText('选项1');
        const option2 = __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByLabelText('选项2');
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(option1);
        expect(Array.from(container.querySelectorAll('.ant-tag')).map((el)=>el.innerHTML)).toMatchInlineSnapshot('\n      [\n        "选项1",\n      ]\n    ');
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(option2);
        expect(Array.from(container.querySelectorAll('.ant-tag')).map((el)=>el.innerHTML)).toMatchInlineSnapshot('\n      [\n        "选项1",\n        "选项2",\n      ]\n    ');
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(option1);
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(option2);
        expect(container.querySelectorAll('.ant-tag')).toMatchInlineSnapshot("NodeList []");
    });
});
