Skip to content

Commit

Permalink
Force fully unpin tooltip before pin due to memleak issues in tests. (#…
Browse files Browse the repository at this point in the history
…16103)

Internal (ui): Force fully unpin tooltip before pin due to memory leak issues in tests.
  • Loading branch information
Mati365 authored Mar 26, 2024
1 parent 90aeb27 commit 11172e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ckeditor5-ui/src/tooltipmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export default class TooltipManager extends DomEmitterMixin() {
targetDomElement: HTMLElement,
{ text, position, cssClass }: TooltipData
): void {
this._unpinTooltipDebounced.cancel();
this._unpinTooltip();

// Use the body collection of the first editor.
const bodyViewCollection = first( TooltipManager._editors.values() )!.ui.view.body;
Expand Down Expand Up @@ -447,6 +447,7 @@ export default class TooltipManager extends DomEmitterMixin() {

this._currentElementWithTooltip = null;
this._currentTooltipPosition = null;
this.tooltipTextView.text = '';

if ( this._resizeObserver ) {
this._resizeObserver.destroy();
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-ui/tests/tooltip/tooltipmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ describe( 'TooltipManager', () => {
sinon.assert.calledOnce( unpinSpy );

utils.waitForTheTooltipToHide( clock );
sinon.assert.calledTwice( unpinSpy );
sinon.assert.calledThrice( unpinSpy );
} );
} );

Expand Down

0 comments on commit 11172e2

Please sign in to comment.