浏览代码

Update tests

panr 6 年之前
父节点
当前提交
1eb7327fe9
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      packages/ckeditor5-restricted-editing/tests/restrictededitingexceptioncommand.js

+ 18 - 0
packages/ckeditor5-restricted-editing/tests/restrictededitingexceptioncommand.js

@@ -133,6 +133,24 @@ describe( 'RestrictedEditingExceptionCommand', () => {
 				expect( model.document.selection.hasAttribute( 'restrictedEditingException' ) ).to.be.false;
 				expect( getData( model ) ).to.equal( '<p>abcfoo[]barbaz</p>' );
 			} );
+
+			it( 'should not remove exception when selection is at the begining of restricted text', () => {
+				setData( model, '<p>abc<$text restrictedEditingException="true">[]foobar</$text>baz</p>' );
+
+				command.execute();
+
+				expect( model.document.selection.hasAttribute( 'restrictedEditingException' ) ).to.be.true;
+				expect( getData( model ) ).to.equal( '<p>abc<$text restrictedEditingException="true">[]foobar</$text>baz</p>' );
+			} );
+
+			it( 'should remove exception when selection is at the end of restricted text', () => {
+				setData( model, '<p>abc<$text restrictedEditingException="true">foobar[]</$text>baz</p>' );
+
+				command.execute();
+
+				expect( model.document.selection.hasAttribute( 'restrictedEditingException' ) ).to.be.false;
+				expect( getData( model ) ).to.equal( '<p>abcfoobar[]baz</p>' );
+			} );
 		} );
 
 		describe( 'non-collapsed selection', () => {