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";
describe('Variable', ()=>{
    it('Variable.Input', async ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo1_mjs__["default"], {}));
        expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByPlaceholderText('Null')).toBeInTheDocument();
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('x'));
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('v1'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('v1', {
                selector: '.ant-tag'
            }).innerHTML).toMatchInlineSnapshot('"v1"');
        });
    });
    it('Variable.TextArea', async ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo2_mjs__["default"], {}));
        const input = document.querySelector('.ant-input');
        const variableSelector = document.querySelector('.ant-select-selector');
        expect(input).toBeInTheDocument();
        expect(variableSelector).toBeInTheDocument();
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(variableSelector);
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByText('v1'));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(input.innerHTML).toMatchInlineSnapshot('"<span class="ant-tag ant-tag-blue" contenteditable="false" data-variable="v1">v1</span>"');
        });
    });
    it('Variable.JSON', async ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__demos_demo3_mjs__["default"], {}));
        const input = document.querySelector('.ant-input');
        const variableSelector = document.querySelector('.ant-select-selector');
        expect(input).toBeInTheDocument();
        expect(variableSelector).toBeInTheDocument();
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(variableSelector);
        await __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.userEvent.click(__WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.screen.getByRole('menuitemcheckbox', {
            name: 'v1'
        }));
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_client__.waitFor)(()=>{
            expect(input.value).toMatchInlineSnapshot('"{{v1}}"');
        });
    });
});
