8
0
Просмотр исходного кода

Merge branch 'master' into i/6106

Aleksander Nowodzinski 6 лет назад
Родитель
Сommit
7d760c5a3a

+ 3 - 3
packages/ckeditor5-ui/src/editorui/bodycollection.js

@@ -20,13 +20,13 @@ import createElement from '@ckeditor/ckeditor5-utils/src/dom/createelement';
  *
  * The body collection is available in the {@link module:ui/editorui/editoruiview~EditorUIView#body `editor.ui.view.body`} property.
  * Any plugin can add a {@link module:ui/view~View view} to this collection.
- * Those views will render in a container placed directly in the `<body>` element.
+ * These views will render in a container placed directly in the `<body>` element.
  * The editor will detach and destroy this collection when the editor will be {@link module:core/editor/editor~Editor#destroy destroyed}.
  *
  * If you need to control the life cycle of the body collection on your own, you can create your own instance of this class.
  *
  * A body collection will render itself automatically in the DOM body element as soon as you call {@link ~BodyCollection#attachToDom}.
- * If you create multiple body collections this class will create a special wrapper element in the DOM to limit the number of
+ * If you create multiple body collections, this class will create a special wrapper element in the DOM to limit the number of
  * elements created directly in the body and remove it when the last body collection will be
  * {@link ~BodyCollection#detachFromDom detached}.
  *
@@ -69,7 +69,7 @@ export default class BodyCollection extends ViewCollection {
 	}
 
 	/**
-	 * Detach the collection from the DOM structure. Use this method when you do not need to use the body collection
+	 * Detaches the collection from the DOM structure. Use this method when you do not need to use the body collection
 	 * anymore to clean-up the DOM structure.
 	 */
 	detachFromDom() {

+ 6 - 1
packages/ckeditor5-ui/tests/toolbar/toolbarview.js

@@ -19,6 +19,7 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/ckeditor5-utils/src/translation-service';
 import Rect from '@ckeditor/ckeditor5-utils/src/dom/rect';
 import Locale from '@ckeditor/ckeditor5-utils/src/locale';
+import ResizeObserver from '@ckeditor/ckeditor5-utils/src/dom/resizeobserver';
 
 describe( 'ToolbarView', () => {
 	let locale, view;
@@ -461,6 +462,11 @@ describe( 'ToolbarView', () => {
 			observeSpy = sinon.spy();
 			unobserveSpy = sinon.spy();
 
+			// 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, the following DOM mock will have no effect.
+			ResizeObserver._observerInstance = null;
+
 			testUtils.sinon.stub( global.window, 'ResizeObserver' ).callsFake( callback => {
 				resizeCallback = callback;
 
@@ -485,7 +491,6 @@ describe( 'ToolbarView', () => {
 		} );
 
 		afterEach( () => {
-			sinon.restore();
 			view.element.remove();
 			view.destroy();
 		} );