Skip to content

Commit

Permalink
Tests (autoformat): Added a unit test to match code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Jul 22, 2020
1 parent b4ebc9b commit 9648425
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/ckeditor5-autoformat/tests/blockautoformatediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ describe( 'blockAutoformatEditing', () => {
sinon.assert.notCalled( spy );
} );

it( 'should ignore a ranged selection', () => {
model.schema.extend( '$text', { allowAttributes: 'foo' } );

const spy = testUtils.sinon.spy();
blockAutoformatEditing( editor, plugin, /^[*]\s$/, spy );

setData( model, '<paragraph>[* ]foo</paragraph>' );
model.change( writer => {
writer.setAttribute( 'foo', true, model.document.selection.getFirstRange() );
} );

sinon.assert.notCalled( spy );
} );

it( 'should stop if there is no text to run matching on', () => {
const spy = testUtils.sinon.spy();
blockAutoformatEditing( editor, plugin, /^[*]\s$/, spy );
Expand Down

0 comments on commit 9648425

Please sign in to comment.