Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 59449d2

Browse files
committed
Fix: Call ResizeObserver.destroy() when destroying block toolbar.
1 parent fcd9c4e commit 59449d2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/toolbar/block/blocktoolbar.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ export default class BlockToolbar extends Plugin {
208208
this.panelView.destroy();
209209
this.buttonView.destroy();
210210
this.toolbarView.destroy();
211+
212+
if ( this._resizeObserver ) {
213+
this._resizeObserver.destroy();
214+
}
211215
}
212216

213217
/**

tests/toolbar/block/blocktoolbar.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,18 @@ describe( 'BlockToolbar', () => {
676676
sinon.assert.notCalled( spy );
677677
} );
678678
} );
679+
680+
describe( 'destroy()', () => {
681+
it( 'should destroy #resizeObserver if is available', () => {
682+
const editable = editor.ui.getEditableElement();
683+
const resizeObserver = new ResizeObserver( editable, () => {} );
684+
const destroySpy = sinon.spy( resizeObserver, 'destroy' );
685+
686+
blockToolbar._resizeObserver = resizeObserver;
687+
688+
blockToolbar.destroy();
689+
690+
sinon.assert.calledOnce( destroySpy );
691+
} );
692+
} );
679693
} );

0 commit comments

Comments
 (0)