Skip to content

Spacing test helper

Compare
Choose a tag to compare
@sir-dunxalot sir-dunxalot released this 01 Jan 12:22
· 515 commits to master since this release
  • #145 - Spacing test helper

This release adds a new public test helper, assertTooltipSpacing(). This helper lets you assert that the tooltip is a given number of pixels from the target on a given side on the target.

This is designed to test the spacing option.

Usage is relatively simple and matches the implementation of existing test helpers:

assertTooltipSpacing(assert, {
  side: 'right',
  spacing: 10, // Tooltip should 10px from right of target
});

You can also pass in selectors:

assertTooltipSpacing(assert, {
  side: 'top',
  spacing: 20, // Tooltip should be 20px above target
  targetSelector: '.test-tooltip-target',
  tooltipSelector: '.test-tooltip',
});