浏览代码

Tests: Added tc for #5910.

Piotrek Koszuliński 5 年之前
父节点
当前提交
72011fb553
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      packages/ckeditor5-code-block/tests/codeblockediting.js

+ 28 - 0
packages/ckeditor5-code-block/tests/codeblockediting.js

@@ -569,6 +569,34 @@ describe( 'CodeBlockEditing', () => {
 					return editor.destroy();
 				} );
 		} );
+
+		// See #5910.
+		it( 'should allow to indent an entire code block with at least two lines', () => {
+			const element = document.createElement( 'div' );
+			document.body.appendChild( element );
+
+			return ClassicTestEditor
+				.create( element, {
+					plugins: [ CodeBlockEditing, AlignmentEditing, IndentEditing ]
+				} )
+				.then( newEditor => {
+					const editor = newEditor;
+
+					editor.setData( '<pre><code class="language-css">\t\tx\n\tx</code></pre>' );
+					editor.model.change( writer => {
+						writer.setSelection( editor.model.document.getRoot().getChild( 0 ), 'on' );
+					} );
+					editor.execute( 'indent' );
+
+					expect( getModelData( editor.model ) ).to.equal(
+						'<codeBlock language="css">[\t\t\tx<softBreak></softBreak>\t\tx]</codeBlock>'
+					);
+
+					element.remove();
+
+					return editor.destroy();
+				} );
+		} );
 	} );
 
 	describe( 'editing pipeline m -> v', () => {