Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getTooltipAndTargetPosition(options = {}) {
const { selector, targetSelector } = options;
const [ target ] = findTooltipTarget(targetSelector);
const [ tooltip ] = findTooltip(selector, { targetSelector });
const targetPosition = target.getBoundingClientRect();
const tooltipPosition = tooltip.getBoundingClientRect();
return {
targetPosition,
tooltipPosition,
};
}
export default function assertTooltipVisible(assert, options = {}) {
const { selector } = options;
const $tooltip = findTooltip(selector, options);
const ariaHidden = $tooltip.attr('aria-hidden');
assert.ok(ariaHidden === 'false',
`assertTooltipVisible(): the ember-tooltip should be visible:
aria-hidden = ${ariaHidden}`);
}
export default function assertTooltipNotVisible(assert, options = {}) {
const { selector } = options;
const $tooltip = findTooltip(selector, options);
const ariaHidden = $tooltip.attr('aria-hidden');
assert.ok(ariaHidden === 'true',
`assertTooltipNotVisible(): the ember-tooltip shouldn't be visible:
aria-hidden = ${ariaHidden}`);
}
export default function assertTooltipRendered(assert, options = {}) {
const { selector } = options;
const $tooltip = findTooltip(selector, options);
assert.equal($tooltip.length, 1, 'assertTooltipRendered(): the ember-tooltip should be rendered');
}
export default function assertTooltipNotRendered(assert, options = {}) {
const { selector } = options;
const $tooltip = findTooltip(selector, options);
assert.equal($tooltip.length, 0, 'assertTooltipNotRendered(): the ember-tooltip should not be rendered');
}
export default function assertTooltipContent(assert, options = {}) {
const { contentString, selector } = options;
if (isNone(contentString)) {
emberAssert('You must specify a contentString property in the options parameter');
}
const $tooltip = findTooltip(selector, options);
const tooltipContent = $tooltip.text().trim();
assert.equal(tooltipContent, contentString,
`Content of tooltip (${tooltipContent}) matched expected (${contentString})`);
}