UI Conditionally Copy Tooltips (#12890)

* adds conditional tooltip copying to InfoTableRow component

* adds changelog entry
This commit is contained in:
Jordan Reimer
2021-10-21 09:26:56 -06:00
committed by GitHub
parent 4ef0d3e187
commit 39b80b8681
7 changed files with 49 additions and 7 deletions

View File

@@ -71,6 +71,29 @@ module('Integration | Component | InfoTableRow', function(hooks) {
assert.equal(tooltip, 'Tooltip text!', 'renders tooltip text');
});
test('it should copy tooltip', async function(assert) {
assert.expect(4);
this.set('isCopyable', false);
await render(hbs`
<InfoTableRow
@label={{label}}
@value={{value}}
@tooltipText="Foo bar"
@isTooltipCopyable={{isCopyable}}
/>
`);
await triggerEvent('[data-test-value-div="test label"] .ember-basic-dropdown-trigger', 'mouseenter');
await settled();
assert.dom('[data-test-tooltip-copy]').hasAttribute('disabled', '', 'Tooltip copy button is disabled');
assert.dom('[data-test-tooltip-copy]').doesNotHaveClass('has-pointer', 'Pointer class not applied when disabled');
this.set('isCopyable', true);
assert.dom('[data-test-tooltip-copy]').doesNotHaveAttribute('disabled', 'Tooltip copy button is enabled');
assert.dom('[data-test-tooltip-copy]').hasClass('has-pointer', 'Pointer class applied to copy button');
});
test('it renders a string with no link if isLink is true and the item type is not an array.', async function(assert) {
// This could be changed in the component so that it adds a link for any item type, but right now it should only add a link if item type is an array.
await render(hbs`<InfoTableRow