浏览代码

Add more tests.

panr 5 年之前
父节点
当前提交
35471248b7
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      packages/ckeditor5-link/tests/autolink.js

+ 20 - 0
packages/ckeditor5-link/tests/autolink.js

@@ -130,6 +130,26 @@ describe( 'AutoLink', () => {
 			);
 		} );
 
+		it( 'does not add linkHref attribute on enter when the link is partially selected (beginning)', () => {
+			setData( model, '<paragraph>[https://www.ckso]urce.com</paragraph>' );
+
+			editor.execute( 'enter' );
+
+			expect( getData( model ) ).to.equal(
+				'<paragraph>[]</paragraph>'
+			);
+		} );
+
+		it( 'does not add linkHref attribute on enter when the link is partially selected (end)', () => {
+			setData( model, '<paragraph>https://www.ckso[urce.com]</paragraph>' );
+
+			editor.execute( 'enter' );
+
+			expect( getData( model ) ).to.equal(
+				'<paragraph>[]</paragraph>'
+			);
+		} );
+
 		it( 'adds linkHref attribute to a text link after space (inside paragraph)', () => {
 			setData( model, '<paragraph>Foo Bar [] Baz</paragraph>' );