瀏覽代碼

Test: integration test for undo/redo bug #2.

Szymon Cofalik 8 年之前
父節點
當前提交
89502db4d1
共有 1 個文件被更改,包括 20 次插入0 次删除
  1. 20 0
      packages/ckeditor5-undo/tests/undoengine-integration.js

+ 20 - 0
packages/ckeditor5-undo/tests/undoengine-integration.js

@@ -328,6 +328,26 @@ describe( 'UndoEngine integration', () => {
 				expect( p.root ).to.equal( gy );
 				expect( p.getAttribute( 'bold' ) ).to.be.true;
 			} );
+
+			// Related to ckeditor5-engine#891.
+			it( 'change attribute of removed node then undo and redo', () => {
+				const gy = doc.graveyard;
+				const batch = doc.batch();
+				const p1 = new Element( 'p' );
+				const p2 = new Element( 'p' );
+				const p3 = new Element( 'p' );
+
+				root.appendChildren( [ p1, p2 ] );
+
+				batch.remove( p1 ).remove( p2 ).insert( new Position( root, [ 0 ] ), p3 );
+
+				editor.execute( 'undo' );
+				editor.execute( 'redo' );
+
+				expect( p1.root ).to.equal( gy );
+				expect( p2.root ).to.equal( gy );
+				expect( p3.root ).to.equal( root );
+			} );
 		} );
 	} );
 } );