UNPKG

wix-style-react

Version:
60 lines 2.29 kB
import { baseUniDriverFactory, findByHook, } from '../test-utils/utils/unidriver'; import { dataHooks } from './constants'; import { iconButtonDriverFactory } from '../IconButton/IconButton.uni.driver'; export const sidebarNextDriverFactory = (base, body) => { const minimizeButtonDriver = iconButtonDriverFactory(findByHook(base, dataHooks.minimizeButton)); return { ...baseUniDriverFactory(base, body), /** * Gets the current selected key * @returns {Promise<string>} */ getSelectedKey: async () => base.attr('data-selected'), /** * Gets the current skin * @returns {Promise<string>} */ getSkin: async () => base.attr('data-skin'), /** * Checks whether the sidebar is hidden * @returns {Promise<boolean>} */ isHidden: async () => (await base.attr('data-hidden')) === 'true', /** * Checks whether the header element exists * @returns {Promise<boolean>} */ headerExists: async () => (await findByHook(base, dataHooks.header)).exists(), /** * Checks whether the footer element exists * @returns {Promise<boolean>} */ footerExists: async () => (await findByHook(base, dataHooks.footer)).exists(), /** * Checks whether the skeleton is displayed * @returns {Promise<boolean>} */ isLoading: async () => (await findByHook(base, dataHooks.skeleton)).exists(), /** * Gets the current width * @returns {Promise<string>} */ getWidth: async () => base.attr('data-width'), /** * Gets the current minimized state * @returns {Promise<boolean>} */ isMinimized: async () => (await base.attr('data-minimized')) === 'true', /** * Clicks on minimization button * @returns {Promise<void>} */ clickOnMinimizeButton: async () => minimizeButtonDriver.click(), /** * Checks whether the minimize button exists * @returns {Promise<boolean>} */ minimizeButtonExists: async () => minimizeButtonDriver.exists(), }; }; //# sourceMappingURL=SidebarNext.uni.driver.js.map