浏览代码

Merge pull request #8325 from ckeditor/tests-inf-selection-loop-detection

Tests (engine): Added the detection for infinite selection rendering loop. See #8263.
Kamil Piechaczek 5 年之前
父节点
当前提交
e6d2de0f4c
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22 0
      packages/ckeditor5-engine/tests/common.js

+ 22 - 0
packages/ckeditor5-engine/tests/common.js

@@ -0,0 +1,22 @@
+/**
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* global console */
+
+// eslint-disable-next-line mocha/no-top-level-hooks
+before( () => {
+	// This is a temporary special handling for https://github.com/ckeditor/ckeditor5/issues/8263
+	// The goal is to show which test case(s) exactly causes the "Selection change observer detected an infinite rendering loop." warn
+	// and reduced engine code coverage.
+	const originalWarn = console.warn;
+
+	console.warn = function( ...args ) {
+		if ( args[ 0 ] == 'Selection change observer detected an infinite rendering loop.' ) {
+			throw new Error( 'Detected unwelcome "Selection change observer detected an infinite rendering loop." warning.' );
+		}
+
+		return originalWarn.apply( args );
+	};
+} );