@wix/design-system
Version:
@wix/design-system
22 lines • 822 B
JavaScript
import { baseUniDriverFactory } from '../utils/test-utils/unidriver';
export const proportionDriverFactory = (base) => {
const byHook = (dataHook) => base.$(`[data-hook="${dataHook}"]`);
return {
...baseUniDriverFactory(base),
/**
* Gets the component's aspect ratio
* @returns {Promise<number>}
*/
getAspectRatio: async () => {
const width = await base.attr('offsetWidth');
const height = await base.attr('offsetHeight');
return +(width ?? 1) / +(height ?? 1);
},
/**
* Checks whether aspect ratio is disabled
* @returns {Promise<boolean>}
*/
isAspectRatioDisabled: async () => byHook('proportion-aspect').exists(),
};
};
//# sourceMappingURL=Proportion.uni.driver.js.map