@wix/design-system
Version:
@wix/design-system
31 lines • 1.17 kB
JavaScript
import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
import { DATA_HOOKS } from './Dock.constants';
export const dockDriverFactory = (base) => {
const getPoint = (position) => base.$(`[data-hook="${DATA_HOOKS.point(position)}"]`);
return {
...baseUniDriverFactory(base),
/**
* Clicks the point at the given position.
*/
clickPoint: position => getPoint(position).click(),
/**
* Checks if the point at the given position is rendered.
*/
pointExists: position => getPoint(position).exists(),
/**
* Checks if the point at the given position is selected.
*/
isPointSelected: async (position) => {
const pressed = await getPoint(position).attr('aria-pressed');
return pressed === 'true';
},
/**
* Checks if the point at the given position is disabled.
*/
isPointDisabled: async (position) => {
const disabledAttr = await getPoint(position).attr('disabled');
return disabledAttr !== null;
},
};
};
//# sourceMappingURL=Dock.uni.driver.js.map