Browse Source

Tests: Fixed failing ResizeObserver tests due to interactions with other tests.

Aleksander Nowodzinski 5 years ago
parent
commit
2caab271ab
1 changed files with 5 additions and 0 deletions
  1. 5 0
      packages/ckeditor5-utils/tests/dom/resizeobserver.js

+ 5 - 0
packages/ckeditor5-utils/tests/dom/resizeobserver.js

@@ -18,6 +18,11 @@ describe( 'ResizeObserver()', () => {
 	testUtils.createSinonSandbox();
 
 	beforeEach( () => {
+		// Make sure other tests of the editor do not affect tests that follow.
+		// Without it, if an instance of ResizeObserver already exists somewhere undestroyed
+		// in DOM, any DOM mock will have no effect.
+		ResizeObserver._observerInstance = null;
+
 		elementA = document.createElement( 'div' );
 		elementA.id = 'A';
 		elementB = document.createElement( 'div' );