import { baseUniDriverFactory } from '../../utils/test-utils/unidriver';
import { dataHooks } from './constants';
export const toggleSwitchUniDriverFactory = (base) => {
    const byDataHook = (dataHook) => `[data-hook="${dataHook}"]`;
    const knob = base.$(byDataHook(dataHooks.knob));
    const knobIcon = base.$(byDataHook(dataHooks.knobIcon));
    const checkbox = base.$(byDataHook(dataHooks.toggleSwitchInput));
    const track = base.$(byDataHook(dataHooks.track));
    const isDisabled = async () => (await base.attr('data-disabled')) === 'true';
    const getKnobIcon = () => knobIcon.getNative();
    return {
        ...baseUniDriverFactory(base),
        // @ts-ignore
        click: async () => !(await isDisabled()) && checkbox.click(),
        isDisabled,
        isChecked: () => checkbox.prop('checked'),
        getKnobIcon,
        hasKnobIcon: async () => !!(await getKnobIcon()).innerHTML,
        getId: () => checkbox.prop('id'),
        getTabIndex: () => checkbox.prop('tabIndex'),
        getRootStyles: () => base.prop('style'),
        getTrackStyles: () => track.prop('style'),
        getKnobStyles: () => knob.prop('style'),
        getKnobIconStyles: () => knobIcon.prop('style'),
        pressEnterKey: () => checkbox.pressKey('Enter'),
    };
};
//# sourceMappingURL=ToggleSwitchCore.uni.driver.js.map