Przeglądaj źródła

Tests: Added a test ensuring that the BodyCollection constructor is properly handling preinitialized collection items.

Marek Lewandowski 5 lat temu
rodzic
commit
66a0ca527c

+ 9 - 0
packages/ckeditor5-ui/tests/editorui/bodycollection.js

@@ -34,6 +34,15 @@ describe( 'BodyCollection', () => {
 
 			expect( instance.locale ).to.be.equal( locale );
 		} );
+
+		it( 'stores pre-initialized collection', () => {
+			const collectionItems = [ new View(), new View() ];
+			const instance = new BodyCollection( locale, collectionItems );
+
+			expect( instance ).to.have.lengthOf( 2 );
+			expect( instance.get( 0 ) ).to.be.equal( collectionItems[ 0 ] );
+			expect( instance.get( 1 ) ).to.be.equal( collectionItems[ 1 ] );
+		} );
 	} );
 
 	describe( 'attachToDom', () => {