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

Commit

Permalink
Added differ test checking differ when moving node from document to d…
Browse files Browse the repository at this point in the history
…ocument fragment.
  • Loading branch information
szymonkups committed Mar 6, 2018
1 parent a0ad8fe commit 8ed5323
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/model/differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,27 @@ describe( 'Differ', () => {
] );
} );
} );

it( 'should not throw when moving node from document to document fragment', () => {
const docFragment = model.change( writer => writer.createDocumentFragment() );
const node = model.change( writer => writer.createText( 'foo' ) );
const changeSpy = sinon.spy();

model.change( writer => {
writer.insert( node, root );
} );

doc.on( 'change', () => {
expect( () => differ.getChanges() ).to.not.throw();
changeSpy();
} );

model.change( writer => {
writer.insert( node, docFragment );
} );

sinon.assert.called( changeSpy );
} );
} );

function insert( item, position ) {
Expand Down

0 comments on commit 8ed5323

Please sign in to comment.