import { baseUniDriverFactory } from '../../../../unidriver';
const { fireEvent = null } = process.env.NODE_ENV === 'test'
    ? (() => {
        try {
            return require('@testing-library/react');
        }
        catch { }
        return {};
    })()
    : {};
export function AddressEditUniDriver(base) {
    const getInput = () => base.$('input');
    const getNativeInput = async () => (await getInput().getNative());
    return {
        ...baseUniDriverFactory(base),
        getValue: async () => {
            const el = await getNativeInput();
            return el?.value ?? '';
        },
        keyDown: async (key) => {
            await getInput().pressKey(key);
        },
        /**
         * Blur the input as if focus moved outside the cell. relatedTarget defaults
         * to <body> so the wrapper's `contains(relatedTarget)` check resolves false.
         */
        blurOutside: async () => {
            const el = await getNativeInput();
            if (!el)
                return;
            fireEvent.blur(el, { relatedTarget: document.body });
        },
    };
}
//# sourceMappingURL=Edit.uni.driver.js.map