Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #93 from ckeditor/t/ckeditor5-engine/1563
Browse files Browse the repository at this point in the history
Tests: Aligned to changes in ckeditor5-engine.
  • Loading branch information
Piotr Jasiun authored Oct 1, 2018
2 parents c4dfcbf + 48c9e2c commit 020bef5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/undocommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,27 @@ describe( 'UndoCommand', () => {
// Remove foobar:
/*
[root]
- p
*/

expect( root.childCount ).to.equal( 0 );
expect( root.childCount ).to.equal( 1 );
expect( root.getChild( 0 ).name ).to.equal( 'p' );

expect( editor.model.document.selection.getFirstRange().isEqual( r( 0, 0 ) ) ).to.be.true;
expect( editor.model.document.selection.getFirstRange().isEqual( r( 1, 1 ) ) ).to.be.true;
expect( editor.model.document.selection.isBackward ).to.be.false;

undo.execute( batch1 );
// Remove attributes.
// 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.childCount ).to.equal( 0 );
expect( root.childCount ).to.equal( 1 );

expect( editor.model.document.selection.getFirstRange().isEqual( r( 0, 0 ) ) ).to.be.true;
expect( editor.model.document.selection.getFirstRange().isEqual( r( 1, 1 ) ) ).to.be.true;
expect( editor.model.document.selection.isBackward ).to.be.false;

expect( doc.graveyard.maxOffset ).to.equal( 4 );
// Graveyard contains "foobar".
expect( doc.graveyard.maxOffset ).to.equal( 6 );

for ( const item of Range.createIn( doc.graveyard ).getItems() ) {
expect( item.hasAttribute( 'key' ) ).to.be.false;
Expand Down

0 comments on commit 020bef5

Please sign in to comment.