浏览代码

Tests (autoformat): Added a unit test to match code coverage.

Marek Lewandowski 5 年之前
父节点
当前提交
9648425945
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      packages/ckeditor5-autoformat/tests/blockautoformatediting.js

+ 14 - 0
packages/ckeditor5-autoformat/tests/blockautoformatediting.js

@@ -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 );