瀏覽代碼

Tests: Clear graveyards in OT tests after editors data is set.

Szymon Cofalik 7 年之前
父節點
當前提交
b286acc45d
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      packages/ckeditor5-engine/tests/model/operation/transform/utils.js

+ 5 - 0
packages/ckeditor5-engine/tests/model/operation/transform/utils.js

@@ -66,6 +66,11 @@ export class Client {
 
 
 		model.document.selection._setTo( ranges );
 		model.document.selection._setTo( ranges );
 
 
+		// Purify graveyard so there are no artifact nodes there remaining after setting new data.
+		// Because of those old nodes some tests may pass even though they fail in real scenarios (those tests
+		// involve bringing back elements from graveyard, like wrap or split).
+		model.document.graveyard._removeChildren( 0, model.document.graveyard.childCount );
+
 		this.syncedVersion = this.document.version;
 		this.syncedVersion = this.document.version;
 	}
 	}