Skip to content

Commit

Permalink
Fix/add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GZolla committed Feb 13, 2025
1 parent 6347f28 commit 336328e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/tooltip/demo/tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ <h2>Help Tooltip</h2>
</d2l-demo-snippet>

<script>
document.addEventListener('click',e => {
document.addEventListener('click', e => {
if (e.target.id !== 'toggle') return;
e.target.disabled = !e.target.disabled;
})
});
document.addEventListener('d2l-tooltip-show', e => console.log('d2l-tooltip-show', e.target));
document.addEventListener('d2l-tooltip-hide', e => console.log('d2l-tooltip-hide', e.target));
</script>
Expand Down
14 changes: 14 additions & 0 deletions components/tooltip/test/tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ describe('d2l-tooltip', () => {

});

it('should not show if added to a disabled target that already has focus', async() => {

const target = tooltipFixture.querySelector('#explicit-target');
target.disabled = true;
await focusElem(target);

const dynamicTooltip = document.createElement('d2l-tooltip');
dynamicTooltip.for = target.id;
tooltipFixture.appendChild(dynamicTooltip);

await aTimeout(100);
expect(dynamicTooltip.showing).to.be.false;
});

});

describe('delay', () => {
Expand Down

0 comments on commit 336328e

Please sign in to comment.