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

Commit

Permalink
Added a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Sep 17, 2019
1 parent c5033b6 commit f6625b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/model/utils/insertcontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,19 @@ describe( 'DataController utils', () => {
expect( stringify( root, affectedRange ) ).to.equal( '[<heading1>bar</heading1>]' );
} );

it.only( 'deletes selection with elements before inserting the content', () => {
model.schema.register( 'div', {
allowWhere: '$block',
allowContentOf: '$root'
} );

setData( model, '<div><paragraph>[Foo</paragraph><paragraph>Bar]</paragraph></div>' );
const affectedRange = insertHelper( '<paragraph>FooBar</paragraph>' );

expect( getData( model ) ).to.equal( '<paragraph>FooBar[]</paragraph>' );
expect( stringify( root, affectedRange ) ).to.equal( '[<paragraph>FooBar</paragraph>]' );
} );

describe( 'block to block handling', () => {
it( 'inserts one paragraph', () => {
setData( model, '<paragraph>f[]oo</paragraph>' );
Expand Down

0 comments on commit f6625b3

Please sign in to comment.