panr 5 lat temu
rodzic
commit
7d10c4a473
1 zmienionych plików z 16 dodań i 6 usunięć
  1. 16 6
      packages/ckeditor5-link/tests/autolink.js

+ 16 - 6
packages/ckeditor5-link/tests/autolink.js

@@ -130,23 +130,33 @@ 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>' );
+		it( 'adds linkHref attribute on enter when the link (that contains www) is partially selected (end)', () => {
+			setData( model, '<paragraph>https://www.ckso[urce.com]</paragraph>' );
 
 			editor.execute( 'enter' );
 
 			expect( getData( model ) ).to.equal(
-				'<paragraph>[]</paragraph>'
+				'<paragraph><$text linkHref="https://www.ckso">https://www.ckso</$text></paragraph><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>' );
+		it( 'does not add linkHref attribute on enter when the link (that does not contain www) is partially selected (end)', () => {
+			setData( model, '<paragraph>https://ckso[urce.com]</paragraph>' );
 
 			editor.execute( 'enter' );
 
 			expect( getData( model ) ).to.equal(
-				'<paragraph>[]</paragraph>'
+				'<paragraph>https://ckso</paragraph><paragraph>[]</paragraph>'
+			);
+		} );
+
+		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><paragraph>[]urce.com</paragraph>'
 			);
 		} );