diff --git a/packages/tooltip/src/LionTooltip.js b/packages/tooltip/src/LionTooltip.js index 54baaac5a..b08680ca6 100644 --- a/packages/tooltip/src/LionTooltip.js +++ b/packages/tooltip/src/LionTooltip.js @@ -20,16 +20,16 @@ export class LionTooltip extends LionPopup { this._show = () => this._controller.show(); this._hide = () => this._controller.hide(); - this.invokerNode.addEventListener('mouseenter', this._show); - this.invokerNode.addEventListener('mouseleave', this._hide); + this.addEventListener('mouseenter', this._show); + this.addEventListener('mouseleave', this._hide); this.invokerNode.addEventListener('focusin', this._show); this.invokerNode.addEventListener('focusout', this._hide); } disconnectedCallback() { super.disconnectedCallback(); - this.invokerNode.removeEventListener('mouseenter', this._show); - this.invokerNode.removeEventListener('mouseleave', this._hide); + this.removeEventListener('mouseenter', this._show); + this.removeEventListener('mouseleave', this._hide); this.invokerNode.removeEventListener('focusin', this._show); this.invokerNode.removeEventListener('focusout', this._hide); } diff --git a/packages/tooltip/test/lion-tooltip.test.js b/packages/tooltip/test/lion-tooltip.test.js index d3b09ac73..693964a94 100644 --- a/packages/tooltip/test/lion-tooltip.test.js +++ b/packages/tooltip/test/lion-tooltip.test.js @@ -21,13 +21,12 @@ describe('lion-tooltip', () => { Tooltip button `); - const invoker = el.querySelector('[slot="invoker"]'); const eventMouseEnter = new Event('mouseenter'); - invoker.dispatchEvent(eventMouseEnter); + el.dispatchEvent(eventMouseEnter); await el.updateComplete; expect(el.querySelector('[slot="content"]').style.display).to.be.equal('inline-block'); const eventMouseLeave = new Event('mouseleave'); - invoker.dispatchEvent(eventMouseLeave); + el.dispatchEvent(eventMouseLeave); await el.updateComplete; expect(el.querySelector('[slot="content"]').style.display).to.be.equal('none'); });