瀏覽代碼

Add test for multi range selection.

Maciej Gołaszewski 6 年之前
父節點
當前提交
84c6b72288
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      packages/ckeditor5-restricted-editing/tests/restrictededitingediting.js

+ 17 - 0
packages/ckeditor5-restricted-editing/tests/restrictededitingediting.js

@@ -371,6 +371,23 @@ describe( 'RestrictedEditingEditing', () => {
 
 					expect( editor.commands.get( commandName ).isEnabled ).to.be.true;
 				} );
+
+				it( 'should be disabled for non-collapsed selection with more then one range', () => {
+					model.change( writer => {
+						writer.setSelection( [
+							writer.createRange(
+								writer.createPositionAt( firstParagraph, 5 ),
+								writer.createPositionAt( firstParagraph, 6 )
+							),
+							writer.createRange(
+								writer.createPositionAt( firstParagraph, 8 ),
+								writer.createPositionAt( firstParagraph, 9 )
+							)
+						] );
+					} );
+
+					expect( editor.commands.get( commandName ).isEnabled ).to.be.false;
+				} );
 			} );
 		}