ソースを参照

Tests: Added unit test for the removeEditorBodyOrphans util function.

See https://github.com/ckeditor/ckeditor5-core/pull/207/files#r363663282
Marek Lewandowski 6 年 前
コミット
b998e8b99f
1 ファイル変更27 行追加0 行削除
  1. 27 0
      packages/ckeditor5-core/tests/_utils-tests/cleanup.js

+ 27 - 0
packages/ckeditor5-core/tests/_utils-tests/cleanup.js

@@ -0,0 +1,27 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* globals document */
+
+import Locale from '@ckeditor/ckeditor5-utils/src/locale';
+import EditorUIView from '@ckeditor/ckeditor5-ui/src/editorui/editoruiview';
+import { removeEditorBodyOrphans } from '../_utils/cleanup';
+
+describe( 'cleanup util', () => {
+	describe( 'removeEditorBodyOrphans()', () => {
+		const locale = new Locale();
+		const uiViews = [ new EditorUIView( locale ), new EditorUIView( locale ) ];
+
+		for ( const view of uiViews ) {
+			view.render();
+		}
+
+		expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 2 );
+
+		removeEditorBodyOrphans();
+
+		expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 0 );
+	} );
+} );