1 | import { assert } from '@ember/debug';
|
2 | import { isNone } from '@ember/utils';
|
3 | import { findTooltip } from 'ember-tooltips/test-support/dom';
|
4 |
|
5 | export default function assertTooltipContent(qunitAssert, options = {}) {
|
6 | const { contentString, selector } = options;
|
7 |
|
8 | if (isNone(contentString)) {
|
9 | assert('You must specify a contentString property in the options parameter');
|
10 | }
|
11 |
|
12 | const tooltip = findTooltip(selector, options);
|
13 |
|
14 | if (!tooltip) {
|
15 | assert(`assertTooltipContent(): Could not find a tooltip for selector: ${selector}`);
|
16 | }
|
17 |
|
18 | const tooltipContent = tooltip.innerText.trim();
|
19 |
|
20 | qunitAssert.equal(tooltipContent, contentString,
|
21 | `Content of tooltip (${tooltipContent}) matched expected (${contentString})`);
|
22 |
|
23 | }
|