import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { toggleButtonDriverFactory } from '../ToggleButton/ToggleButton.uni.driver';
const getItem = (base, itemId) => base.$(`[data-hook="composer-sidebar-item-${itemId}"]`);
const getItemContainer = (base, itemId) => base.$(`[data-hook="composer-sidebar-item-container-${itemId}"]`);
const getToggleButtonDriver = async (base, body, itemId) => {
    const item = await getItem(base, itemId);
    return toggleButtonDriverFactory(item, body);
};
export const composerSidebarDriverFactory = (base, body) => {
    return {
        ...baseUniDriverFactory(base, body),
        /** returns selected item id */
        getSelectedItemId: async () => await base
            .$('[data-hook="composer-sidebar-items-container"]')
            .attr('data-selected-id'),
        /** returns true if item is disabled */
        isItemDisabled: async (itemId) => {
            const toggleButtonDriver = await getToggleButtonDriver(base, body, itemId);
            return toggleButtonDriver.isButtonDisabled();
        },
        /** clicks on given item by id */
        clickOnItem: async (itemId) => {
            const toggleButtonDriver = await getToggleButtonDriver(base, body, itemId);
            return toggleButtonDriver.click();
        },
        /** returns item label value by id */
        getItemLabel: async (itemId) => {
            const toggleButtonDriver = await getToggleButtonDriver(base, body, itemId);
            return toggleButtonDriver.getLabelValue();
        },
        /** returns label placement value */
        getLabelPlacement: async () => base
            .$('[data-hook="composer-sidebar-items-container"]')
            .attr('data-label-placement'),
        /** returns item section title by id */
        getItemSectionTitle: async (itemId) => await getItemContainer(base, itemId).attr('data-section-title'),
    };
};
//# sourceMappingURL=ComposerSidebar.uni.driver.js.map