How to use the ember-tooltips/test-support/jquery.getOppositeSide function in ember-tooltips

To help you get started, we’ve selected a few ember-tooltips examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sir-dunxalot / ember-tooltips / addon-test-support / jquery / get-position-differences.js View on Github external
export default function getPositionDifferences(options = {}) {
  const { targetPosition, tooltipPosition } = getTooltipAndTargetPosition(options);
  const { side } = options;

  const distanceToTarget = targetPosition[side];
  const distanceToTooltip = tooltipPosition[getOppositeSide(side)];
  const shouldTooltipBeCloserThanTarget = side === 'top' || side === 'left';
  const expectedGreaterDistance = shouldTooltipBeCloserThanTarget ? distanceToTarget : distanceToTooltip;
  const expectedLesserDistance = shouldTooltipBeCloserThanTarget ? distanceToTooltip : distanceToTarget;

  return { expectedGreaterDistance, expectedLesserDistance };
}