"use strict";
var __webpack_exports__ = {};
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/test/client");
const external_vitest_namespaceObject = require("vitest");
const index_js_namespaceObject = require("../utils/index.js");
(0, external_vitest_namespaceObject.describe)('utils', ()=>{
    (0, external_vitest_namespaceObject.describe)('normalizeContainer', ()=>{
        let originalConsoleWarn;
        beforeEach(()=>{
            originalConsoleWarn = console.warn;
        });
        afterEach(()=>{
            console.warn = originalConsoleWarn;
        });
        it('when container is undefined or null, return null', ()=>{
            const fn = vitest.fn();
            console.warn = fn;
            expect((0, index_js_namespaceObject.normalizeContainer)(void 0)).toBeNull();
            expect(fn).toBeCalledTimes(1);
        });
        it('when container is string and can not find element, return null', ()=>{
            const fn = vitest.fn();
            console.warn = fn;
            expect((0, index_js_namespaceObject.normalizeContainer)('#app')).toBeNull();
            expect(fn).toBeCalledTimes(1);
        });
        it('when container is string and can find element, return element', ()=>{
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                id: "app",
                children: "App"
            }));
            expect((0, index_js_namespaceObject.normalizeContainer)('#app')).toBeInTheDocument();
        });
        it('when container is element, return element', ()=>{
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                id: "app",
                children: "App"
            }));
            const element = document.getElementById('#app');
            expect((0, index_js_namespaceObject.normalizeContainer)(element)).toBe(element);
        });
    });
    (0, external_vitest_namespaceObject.describe)('compose', ()=>{
        const Hello = (param)=>{
            let { children } = param;
            return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                children: [
                    "Hello ",
                    children
                ]
            });
        };
        const World = (param)=>{
            let { name, children } = param;
            return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                children: [
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                        children: "World"
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                        children: name
                    }),
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                        children: children
                    })
                ]
            });
        };
        const Foo = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                children: "Foo"
            });
        it('compose without LastComponent', ()=>{
            const composeFn = (0, index_js_namespaceObject.compose)([
                Hello,
                void 0
            ], [
                World,
                {
                    name: 'aaa'
                }
            ]);
            const Compose = composeFn();
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Compose, {}));
            expect(client_namespaceObject.screen.getByText('Hello')).toBeInTheDocument();
            expect(client_namespaceObject.screen.getByText('aaa')).toBeInTheDocument();
            expect(client_namespaceObject.screen.getByText('World')).toBeInTheDocument();
        });
        it('compose with LastComponent', ()=>{
            const composeFn = (0, index_js_namespaceObject.compose)([
                Hello,
                void 0
            ]);
            const Compose = composeFn(Foo);
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Compose, {}));
            expect(client_namespaceObject.screen.getByText('Hello')).toBeInTheDocument();
            expect(client_namespaceObject.screen.getByText('Foo')).toBeInTheDocument();
        });
    });
});
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
});
