"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 e2e_namespaceObject = require("@tachybase/test/e2e");
const external_dayjs_namespaceObject = require("dayjs");
var external_dayjs_default = /*#__PURE__*/ __webpack_require__.n(external_dayjs_namespaceObject);
const external_utils_js_namespaceObject = require("./utils.js");
(0, e2e_namespaceObject.test)('Date display format in form', async (param)=>{
    let { page, mockPage } = param;
    await mockPage(external_utils_js_namespaceObject.oneFormBlockWithDatetimeFields).goto();
    await (0, e2e_namespaceObject.expectSettingsMenu)({
        page,
        showMenu: async ()=>{
            await page.getByPlaceholder('Select date').hover();
            await page.getByLabel('block-item-CollectionField').hover();
            await page.getByLabel('designer-schema-settings-CollectionField-fieldSettings:FormItem-general').hover();
        },
        supportedOptions: [
            'Edit field title',
            'Display title',
            'Edit description',
            'Edit tooltip',
            'Required',
            'Set default value',
            'Pattern',
            'Date display format',
            'Delete'
        ]
    });
    await page.getByText('Date display format').click();
    await page.getByLabel('Show time').check();
    await page.getByRole('button', {
        name: 'HH:mm:ss',
        exact: true
    }).click();
    await page.getByRole('button', {
        name: 'OK'
    }).click();
    await page.getByPlaceholder('Select date').click();
    await page.getByText('Now').click();
    const value = await page.getByPlaceholder('Select date').inputValue();
    (0, e2e_namespaceObject.expect)(value).toBe(external_dayjs_default()(value).format('YYYY-MM-DD HH:mm:ss'));
});
(0, e2e_namespaceObject.test)('Date display format in table', async (param)=>{
    let { page, mockPage, mockRecord } = param;
    await mockPage(external_utils_js_namespaceObject.oneTableBlockWithDatetimeFields).goto();
    const date = new Date().toDateString();
    await mockRecord('general', {
        datetime: date
    });
    await (0, e2e_namespaceObject.expectSettingsMenu)({
        page,
        showMenu: async ()=>{
            await page.getByRole('button', {
                name: 'datetime'
            }).hover();
            await page.getByLabel('designer-schema-settings-TableV2.Column-fieldSettings:TableColumn-general').hover();
        },
        supportedOptions: [
            'Custom column title',
            'Column width',
            'Sortable',
            'Date display format',
            'Delete'
        ]
    });
    await page.getByText('Date display format').click();
    await page.getByLabel('Show time').check();
    await page.getByRole('button', {
        name: 'hh:mm:ss a'
    }).click();
    await page.getByRole('button', {
        name: 'OK'
    }).click();
    await (0, e2e_namespaceObject.expect)(page.getByRole('button', {
        name: external_dayjs_default()(date).format('YYYY-MM-DD hh:mm:ss a')
    })).toBeVisible();
});
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
});
