UNPKG

651 BJavaScriptView Raw
1import { getPositionDifferences } from 'ember-tooltips/test-support/dom';
2import { validateSide } from 'ember-tooltips/test-support/utils';
3
4export default function assertTooltipSide(assert, options = {}) {
5 const { side } = options;
6
7 validateSide(side);
8
9 const { expectedGreaterDistance, expectedLesserDistance } = getPositionDifferences(options);
10
11 /* When the side is top or left, the greater number
12 is the target's position. Thus, we check that the
13 target's position is greater than the tooltip's
14 position. */
15
16 assert.ok(expectedGreaterDistance > expectedLesserDistance,
17 `Tooltip should be on the ${side} side of the target`);
18}