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_demo1_mjs__ from "../demos/demo1.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_demo2_mjs__ from "../demos/demo2.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_demo3_mjs__ from "../demos/demo3.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__demos_demo4_mjs__ from "../demos/demo4.mjs";
describe('Action', ()=>{
    it('show the drawer when click the button', async ()=>{
        const { getByText } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo1_mjs__["default"], {}));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
        });
        expect(document.querySelector('.ant-drawer-mask')).toBeInTheDocument();
        expect(getByText('Drawer Title')).toBeInTheDocument();
        expect(getByText('Hello')).toBeInTheDocument();
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Close'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(document.querySelector('.ant-drawer-mask'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(document.querySelector('.ant-drawer-close'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
    });
    it('openMode', async ()=>{
        const { getByText } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo3_mjs__["default"], {}));
        expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        expect(document.querySelector('.ant-modal')).not.toBeInTheDocument();
        expect(document.querySelector('.tb-action-page')).not.toBeInTheDocument();
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Drawer'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
            expect(document.querySelector('.ant-modal')).not.toBeInTheDocument();
            expect(document.querySelector('.tb-action-page')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Close'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Modal'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
            expect(document.querySelector('.ant-modal')).toBeInTheDocument();
            expect(document.querySelector('.tb-action-page')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Close'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Page'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
            expect(document.querySelector('.ant-modal')).not.toBeInTheDocument();
            expect(document.querySelector('.tb-action-page')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Close'));
    });
});
describe('Action.Drawer without Action', ()=>{
    it('show the drawer when click the button', async ()=>{
        const { getByText } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo2_mjs__["default"], {}));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
            expect(document.querySelector('.ant-drawer-mask')).toBeInTheDocument();
            expect(getByText('Drawer Title')).toBeInTheDocument();
            expect(getByText('Hello')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Close'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(document.querySelector('.ant-drawer-mask'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(getByText('Open'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).toBeInTheDocument();
        });
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(document.querySelector('.ant-drawer-close'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-drawer')).not.toBeInTheDocument();
        });
    });
});
describe('Action.Popover', ()=>{
    it('show the popover when hover the button', async ()=>{
        const { container } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo4_mjs__["default"], {}));
        const btn = container.querySelector('.ant-btn');
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.mouseEnter(btn);
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-popover')).toBeInTheDocument();
            expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('Hello')).toBeInTheDocument();
        });
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.fireEvent.mouseLeave(btn);
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(document.querySelector('.ant-popover')).not.toBeInTheDocument();
        });
    });
});
