Browse Source

Tests: Added missing tests for Node.getPath().

Piotr Jasiun 10 năm trước cách đây
mục cha
commit
3350345f4f
1 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 15 0
      packages/ckeditor5-engine/tests/document/node.js

+ 15 - 0
packages/ckeditor5-engine/tests/document/node.js

@@ -235,4 +235,19 @@ describe( 'Node', function() {
 			).to.throw( CKEditorError, /node-not-found-in-parent/ );
 		} );
 	} );
+
+	describe( 'getPath', function() {
+		it( 'should return proper path', function() {
+			expect( root.getPath() ).to.deep.equal( [] );
+
+			expect( one.getPath() ).to.deep.equal( [ 0 ] );
+			expect( two.getPath() ).to.deep.equal( [ 1 ] );
+			expect( three.getPath() ).to.deep.equal( [ 2 ] );
+
+			expect( charB.getPath() ).to.deep.equal( [ 1, 0 ] );
+			expect( charA.getPath() ).to.deep.equal( [ 1, 1 ] );
+			expect( img.getPath() ).to.deep.equal( [ 1, 2 ] );
+			expect( charR.getPath() ).to.deep.equal( [ 1, 3 ] );
+		} );
+	} );
 } );