"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
var __webpack_exports__ = {};
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/test/client");
const checkbox_js_namespaceObject = require("../demos/checkbox.js");
var checkbox_js_default = /*#__PURE__*/ __webpack_require__.n(checkbox_js_namespaceObject);
const checkbox_group_js_namespaceObject = require("../demos/checkbox.group.js");
var checkbox_group_js_default = /*#__PURE__*/ __webpack_require__.n(checkbox_group_js_namespaceObject);
describe('Checkbox', ()=>{
    it('should display the title', ()=>{
        (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_js_default(), {}));
        expect(client_namespaceObject.screen.getByText('编辑模式').innerHTML).toBe('编辑模式');
        expect(client_namespaceObject.screen.getByText('阅读模式').innerHTML).toBe('阅读模式');
    });
    it('should display the icon when checked', async ()=>{
        const { container } = (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_js_default(), {}));
        const input = container.querySelector('input');
        await client_namespaceObject.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 client_namespaceObject.userEvent.click(input);
        expect(container.querySelector('svg')).toBeNull();
    });
});
describe('Checkbox.Group', ()=>{
    it('should display the title', ()=>{
        (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_group_js_default(), {}));
        expect(client_namespaceObject.screen.getByText('编辑模式').innerHTML).toBe('编辑模式');
        expect(client_namespaceObject.screen.getByText('阅读模式').innerHTML).toBe('阅读模式');
    });
    it('should display the tag when checked', async ()=>{
        const { container } = (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_group_js_default(), {}));
        const option1 = client_namespaceObject.screen.getByLabelText('选项1');
        const option2 = client_namespaceObject.screen.getByLabelText('选项2');
        await client_namespaceObject.userEvent.click(option1);
        expect(Array.from(container.querySelectorAll('.ant-tag')).map((el)=>el.innerHTML)).toMatchInlineSnapshot('\n      [\n        "选项1",\n      ]\n    ');
        await client_namespaceObject.userEvent.click(option2);
        expect(Array.from(container.querySelectorAll('.ant-tag')).map((el)=>el.innerHTML)).toMatchInlineSnapshot('\n      [\n        "选项1",\n        "选项2",\n      ]\n    ');
        await client_namespaceObject.userEvent.click(option1);
        await client_namespaceObject.userEvent.click(option2);
        expect(container.querySelectorAll('.ant-tag')).toMatchInlineSnapshot("NodeList []");
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
