import ReactTestUtils from 'react-dom/test-utils';
import { testkitFactoryCreator } from '@wix/wix-ui-test-utils/vanilla';
import { isClassExists } from '../utils/test-utils';
import textDriverFactory from '../Text/Text.driver';
import checkboxDriverFactory from '../Checkbox/Checkbox.driver';
const textTestkitFactory = testkitFactoryCreator(textDriverFactory);
const checkboxTestkitFactory = testkitFactoryCreator(checkboxDriverFactory);
const selectorDriverFactory = ({ element }) => {
    const toggleInput = () => element.querySelector('[data-hook="toggle"] input');
    const image = () => element.querySelector('[data-hook="selector-image"]');
    const titleTextDriver = () => textTestkitFactory({ wrapper: element, dataHook: 'selector-title' });
    const subtitleTextDriver = () => textTestkitFactory({ wrapper: element, dataHook: 'selector-subtitle' });
    const extraNode = () => element.querySelector('[data-hook="selector-extra-node"]');
    const checkboxDriver = () => checkboxTestkitFactory({ wrapper: element, dataHook: 'toggle' });
    return {
        exists: () => !!element,
        isImageTiny: () => isClassExists(image(), 'tiny'),
        isImageSmall: () => isClassExists(image(), 'small'),
        isImagePortrait: () => isClassExists(image(), 'portrait'),
        isImageLarge: () => isClassExists(image(), 'large'),
        isImageCinema: () => isClassExists(image(), 'cinema'),
        isImageCircle: () => isClassExists(image(), 'circle'),
        isImageRectangular: () => isClassExists(image(), 'rectangular'),
        isDisabled: () => toggleInput().disabled,
        isIndeterminate: () => checkboxDriver().isIndeterminate(),
        toggleType: () => toggleInput().type,
        isChecked: () => !!toggleInput().checked,
        hasImage: () => !!image(),
        getImage: () => image().childNodes[0],
        titleTextDriver,
        subtitleTextDriver,
        hasExtraNode: () => !!extraNode(),
        getExtraNode: () => extraNode().childNodes[0],
        toggle: () => ReactTestUtils.Simulate.click(element),
    };
};
export default selectorDriverFactory;
//# sourceMappingURL=Selector.driver.js.map