瀏覽代碼

Fixes required by ckeditor5-engine/t/518.

Szymon Cofalik 9 年之前
父節點
當前提交
3dce7d680a
共有 2 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      packages/ckeditor5-undo/src/undocommand.js
  2. 6 6
      packages/ckeditor5-undo/tests/undocommand.js

+ 1 - 1
packages/ckeditor5-undo/src/undocommand.js

@@ -265,7 +265,7 @@ function transformRangesByDeltas( ranges, deltas ) {
 					case 'insert':
 						result = ranges[ i ]._getTransformedByInsertion(
 							operation.position,
-							operation.nodes.getMaxOffset(),
+							operation.nodes.maxOffset,
 							true
 						);
 						break;

+ 6 - 6
packages/ckeditor5-undo/tests/undocommand.js

@@ -175,7 +175,7 @@ describe( 'UndoCommand', () => {
 			 [root]
 			 */
 
-			expect( root.getChildCount() ).to.equal( 0 );
+			expect( root.childCount ).to.equal( 0 );
 			expect( editor.document.selection.getRanges().next().value.isEqual( r( 0, 0 ) ) ).to.be.true;
 		} );
 
@@ -218,7 +218,7 @@ describe( 'UndoCommand', () => {
 			// The `P` element wasn't removed because it wasn`t added by undone batch.
 			// It would be perfect if the `P` got removed aswell because wrapping was on removed nodes.
 			// But this would need a lot of logic / hardcoded ifs or a post-fixer.
-			expect( root.getChildCount() ).to.equal( 1 );
+			expect( root.childCount ).to.equal( 1 );
 			expect( itemAt( root, 0 ).name ).to.equal( 'p' );
 
 			expect( editor.document.selection.getRanges().next().value.isEqual( r( 0, 0 ) ) ).to.be.true;
@@ -229,14 +229,14 @@ describe( 'UndoCommand', () => {
 			// This does nothing in the `root` because attributes were set on nodes that already got removed.
 			// But those nodes should change in the graveyard and we can check them there.
 
-			expect( root.getChildCount() ).to.equal( 1 );
+			expect( root.childCount ).to.equal( 1 );
 			expect( itemAt( root, 0 ).name ).to.equal( 'p' );
 
 			// Operations for undoing that batch were working on graveyard so document selection should not change.
 			expect( editor.document.selection.getRanges().next().value.isEqual( r( 0, 0 ) ) ).to.be.true;
 			expect( editor.document.selection.isBackward ).to.be.false;
 
-			expect( doc.graveyard.getChild( 0 ).getMaxOffset() ).to.equal( 6 );
+			expect( doc.graveyard.getChild( 0 ).maxOffset ).to.equal( 6 );
 
 			for ( let char of doc.graveyard._children ) {
 				expect( char.hasAttribute( 'key' ) ).to.be.false;
@@ -244,7 +244,7 @@ describe( 'UndoCommand', () => {
 
 			// Let's undo wrapping. This should leave us with empty root.
 			undo._execute( batch3 );
-			expect( root.getMaxOffset() ).to.equal( 0 );
+			expect( root.maxOffset ).to.equal( 0 );
 
 			// Once again transformed range ends up in the graveyard.
 			expect( editor.document.selection.getRanges().next().value.isEqual( r( 0, 0 ) ) ).to.be.true;
@@ -257,7 +257,7 @@ describe( 'UndoCommand', () => {
 		function getCaseText( root ) {
 			let text = '';
 
-			for ( let i = 0; i < root.getChildCount(); i++ ) {
+			for ( let i = 0; i < root.childCount; i++ ) {
 				let node = root.getChild( i );
 				text += node.getAttribute( 'uppercase' ) ? node.data.toUpperCase() : node.data;
 			}