8
0
Pārlūkot izejas kodu

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

Piotr Jasiun 10 gadi atpakaļ
vecāks
revīzija
dde8cf9396
1 mainītis faili ar 15 papildinājumiem un 0 dzēšanām
  1. 15 0
      packages/ckeditor5-utils/tests/document/node.js

+ 15 - 0
packages/ckeditor5-utils/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 ] );
+		} );
+	} );
 } );