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

Added test for checking whether #document property is being updated after inserting a children to an element.

Kamil Piechaczek 6 лет назад
Родитель
Сommit
f1cd1c67b9
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      packages/ckeditor5-engine/tests/view/element.js

+ 9 - 0
packages/ckeditor5-engine/tests/view/element.js

@@ -403,6 +403,15 @@ describe( 'Element', () => {
 				expect( element.getChild( 0 ) ).to.be.instanceof( Text );
 				expect( element.getChild( 0 ).data ).to.equal( 'cxy' );
 			} );
+
+			it( 'set proper #document on inserted children', () => {
+				const anotherDocument = new Document();
+				const anotherEl = new Element( anotherDocument, 'p' );
+
+				parent._insertChild( 0, anotherEl );
+
+				expect( anotherEl.document ).to.be.equal( document );
+			} );
 		} );
 
 		describe( 'getChildIndex', () => {