Преглед на файлове

Renamed link arrtibute to linkHref + minor tests refactoring.

Oskar Wrobel преди 9 години
родител
ревизия
d20e5ba102

+ 13 - 13
packages/ckeditor5-link/src/linkcommand.js

@@ -24,7 +24,7 @@ export default class LinkCommand extends Command {
 		super( editor );
 
 		/**
-		 * Currently selected link attribute value.
+		 * Currently selected linkHref attribute value.
 		 *
 		 * @observable
 		 * @member {Boolean} core.command.ToggleAttributeCommand#value
@@ -32,7 +32,7 @@ export default class LinkCommand extends Command {
 		this.set( 'value', undefined );
 
 		this.listenTo( this.editor.document.selection, 'change:attribute', () => {
-			this.value = this.editor.document.selection.getAttribute( 'link' );
+			this.value = this.editor.document.selection.getAttribute( 'linkHref' );
 		} );
 	}
 
@@ -45,16 +45,16 @@ export default class LinkCommand extends Command {
 	_checkEnabled() {
 		const document = this.editor.document;
 
-		return isAttributeAllowedInSelection( 'link', document.selection, document.schema );
+		return isAttributeAllowedInSelection( 'linkHref', document.selection, document.schema );
 	}
 
 	/**
 	 * Executes the command.
 	 *
-	 * When selection is non-collapsed then `link` attribute will be applied to nodes inside selection, but only to
-	 * this nodes where `link` attribute is allowed (disallowed nodes will be omitted).
+	 * When selection is non-collapsed then `linkHref` attribute will be applied to nodes inside selection, but only to
+	 * this nodes where `linkHref` attribute is allowed (disallowed nodes will be omitted).
 	 *
-	 * When selection is collapsed then new {@link engine.model.Text Text node} with `link` attribute will be inserted
+	 * When selection is collapsed then new {@link engine.model.Text Text node} with `linkHref` attribute will be inserted
 	 * in place of caret, but only if such an element is allowed in this place. _data of inserted text will be equal
 	 * to `href` parameter. Selection will be updated to wrap just inserted text node.
 	 *
@@ -73,23 +73,23 @@ export default class LinkCommand extends Command {
 				const position = selection.getFirstPosition();
 				const parent = position.parent;
 
-				// Insert Text node with link attribute if is allowed in parent.
-				if ( document.schema.check( { name: '$text', attributes: 'link', inside: parent.name } ) ) {
-					const node = new Text( href, { link: href } );
+				// Insert Text node with linkHref attribute if is allowed in parent.
+				if ( document.schema.check( { name: '$text', attributes: 'linkHref', inside: parent.name } ) ) {
+					const node = new Text( href, { linkHref: href } );
 
 					batch.insert( position, node );
 
 					// Create new range wrapping just created node.
 					selection.setRanges( [ Range.createOn( node ) ] );
-					selection.setAttribute( 'link', href );
+					selection.setAttribute( 'linkHref', href );
 				}
 			} else {
 				// If selection has non-collapsed ranges, we change attribute on nodes inside those ranges
-				// omitting nodes where `link` attribute is disallowed.
-				const ranges = getSchemaValidRanges( 'link', selection.getRanges(), document.schema );
+				// omitting nodes where `linkHref` attribute is disallowed.
+				const ranges = getSchemaValidRanges( 'linkHref', selection.getRanges(), document.schema );
 
 				for ( let range of ranges ) {
-					batch.setAttribute( range, 'link', href );
+					batch.setAttribute( range, 'linkHref', href );
 				}
 			}
 		} );

+ 5 - 5
packages/ckeditor5-link/src/linkengine.js

@@ -13,7 +13,7 @@ import UnlinkCommand from './unlinkcommand.js';
 /**
  * The link engine feature.
  *
- * It introduces the `link="url"` attribute in the model which renders to the view as a `<a href="url">` element.
+ * It introduces the `linkHref="url"` attribute in the model which renders to the view as a `<a href="url">` element.
  *
  * @memberOf link
  * @extends core.Feature
@@ -28,18 +28,18 @@ export default class LinkEngine extends Feature {
 		const editing = editor.editing;
 
 		// Allow link attribute on all inline nodes.
-		editor.document.schema.allow( { name: '$inline', attributes: [ 'link' ] } );
+		editor.document.schema.allow( { name: '$inline', attributes: 'linkHref' } );
 
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )
-			.fromAttribute( 'link' )
-			.toElement( ( href ) => new AttributeElement( 'a', { href } ) );
+			.fromAttribute( 'linkHref' )
+			.toElement( ( linkHref ) => new AttributeElement( 'a', { href: linkHref } ) );
 
 		// Build converter from view to model for data pipeline.
 		buildViewConverter().for( data.viewToModel )
 			.fromElement( 'a' )
 			.toAttribute( ( viewElement ) => ( {
-				key: 'link',
+				key: 'linkHref',
 				value: viewElement.getAttribute( 'href' )
 			} ) );
 

+ 13 - 14
packages/ckeditor5-link/src/unlinkcommand.js

@@ -15,10 +15,9 @@ export default class UnlinkCommand extends Command {
 	/**
 	 * Executes the command.
 	 *
-	 * When selection is collapsed then whole link will be unlinked. {@link engine.model.TreeWalker TreeWalker} is
-	 * looking for link bounds going forward and backward from the caret position.
+	 * When selection is collapsed then walk through each stick node with `linkHref` attribute and remove this attribute.
 	 *
-	 * If selection is non-collapsed then only selected range will be unlinked.
+	 * If selection is non-collapsed then remove `linkHref` from each node in selected range.
 	 *
 	 * @protected
 	 */
@@ -30,19 +29,19 @@ export default class UnlinkCommand extends Command {
 			// Keep it as one undo step.
 			const batch = document.batch();
 
-			// When selection is collapsed we have to remove link attribute from every stick sibling with the same attribute value.
+			// When selection is collapsed we are removing `linkHref` attribute from every stick sibling with the same attribute value.
 			if ( selection.isCollapsed ) {
-				const linkValue = selection.getAttribute( 'link' );
+				const linkValue = selection.getAttribute( 'linkHref' );
 				const position = selection.getFirstPosition();
 				let sibling;
 
 				// Get node on the right side of the selection. When selection is inside TextNode then get this node.
 				sibling = position.textNode === null ? position.nodeAfter : position.textNode;
 
-				// Walk forward and remove link attribute from each stick element with the same attribute value.
+				// Walk forward and remove `linkHref` attribute from each stick element with the same attribute value.
 				while ( sibling ) {
-					if ( sibling.getAttribute( 'link' ) == linkValue ) {
-						batch.removeAttribute( sibling, 'link' );
+					if ( sibling.getAttribute( 'linkHref' ) == linkValue ) {
+						batch.removeAttribute( sibling, 'linkHref' );
 						sibling = sibling.nextSibling;
 					} else {
 						sibling = null;
@@ -50,22 +49,22 @@ export default class UnlinkCommand extends Command {
 				}
 
 				// Get node on the left side of the selection. When selection is inside TextNode then get node just after
-				// TextNode because link attribute has been already removed from TextNode during forward walking.
+				// TextNode because `linkHref` attribute has been already removed from TextNode during forward walking.
 				sibling = position.textNode === null ? position.nodeBefore : position.textNode.previousSibling;
 
-				// Walk backward and remove link attribute from each stick element with the same attribute value.
+				// Walk backward and remove `linkHref` attribute from each stick element with the same attribute value.
 				while ( sibling ) {
-					if ( sibling.getAttribute( 'link' ) == linkValue ) {
-						batch.removeAttribute( sibling, 'link' );
+					if ( sibling.getAttribute( 'linkHref' ) == linkValue ) {
+						batch.removeAttribute( sibling, 'linkHref' );
 						sibling = sibling.previousSibling;
 					} else {
 						sibling = null;
 					}
 				}
 			} else {
-				// When selection is non-collapsed then we are unlinking selected ranges.
+				// When selection is non-collapsed then we are removing `linkHref` attribute from each node inside the ranges.
 				for ( let range of selection.getRanges() ) {
-					batch.removeAttribute( range, 'link' );
+					batch.removeAttribute( range, 'linkHref' );
 				}
 			}
 		} );

+ 56 - 41
packages/ckeditor5-link/tests/linkcommand.js

@@ -20,9 +20,9 @@ describe( 'LinkCommand', () => {
 				// Allow text in $root.
 				document.schema.allow( { name: '$text', inside: '$root' } );
 
-				// Allow text with link attribute in paragraph.
+				// Allow text with linkHref attribute in paragraph.
 				document.schema.registerItem( 'p', '$block' );
-				document.schema.allow( { name: '$text', attributes: 'link', inside: '$root' } );
+				document.schema.allow( { name: '$text', attributes: 'linkHref', inside: '$root' } );
 			} );
 	} );
 
@@ -32,13 +32,13 @@ describe( 'LinkCommand', () => {
 
 	describe( 'value', () => {
 		describe( 'collapsed selection', () => {
-			it( 'should be equal attribute value when selection is placed inside element with link attribute', () => {
-				setData( document, `<$text link="url">foo[]bar</$text>` );
+			it( 'should be equal attribute value when selection is placed inside element with linkHref attribute', () => {
+				setData( document, `<$text linkHref="url">foo[]bar</$text>` );
 
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should be undefined when selection is placed inside element without link attribute', () => {
+			it( 'should be undefined when selection is placed inside element without linkHref attribute', () => {
 				setData( document, `<$text bold="true">foo[]bar</$text>` );
 
 				expect( command.value ).to.undefined;
@@ -46,14 +46,14 @@ describe( 'LinkCommand', () => {
 		} );
 
 		describe( 'non-collapsed selection', () => {
-			it( 'should be equal attribute value when selection contains only elements with link attribute', () => {
-				setData( document, 'fo[<$text link="url">ob</$text>]ar' );
+			it( 'should be equal attribute value when selection contains only elements with linkHref attribute', () => {
+				setData( document, 'fo[<$text linkHref="url">ob</$text>]ar' );
 
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should be undefined when selection contains not only elements with link attribute', () => {
-				setData( document, 'f[o<$text link="url">ob</$text>]ar' );
+			it( 'should be undefined when selection contains not only elements with linkHref attribute', () => {
+				setData( document, 'f[o<$text linkHref="url">ob</$text>]ar' );
 
 				expect( command.value ).to.undefined;
 			} );
@@ -62,18 +62,18 @@ describe( 'LinkCommand', () => {
 
 	describe( '_doExecute', () => {
 		describe( 'non-collapsed selection', () => {
-			it( 'should set link attribute to selected text', () => {
+			it( 'should set linkHref attribute to selected text', () => {
 				setData( document, 'f[ooba]r' );
 
 				expect( command.value ).to.undefined;
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) ).to.equal( 'f[<$text link="url">ooba</$text>]r' );
+				expect( getData( document ) ).to.equal( 'f[<$text linkHref="url">ooba</$text>]r' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should set link attribute to selected text when text already has attributes', () => {
+			it( 'should set linkHref attribute to selected text when text already has attributes', () => {
 				setData( document, 'f[o<$text bold="true">oba]r</$text>' );
 
 				expect( command.value ).to.undefined;
@@ -81,56 +81,66 @@ describe( 'LinkCommand', () => {
 				command._doExecute( 'url' );
 
 				expect( command.value ).to.equal( 'url' );
-				expect( getData( document ) )
-					.to.equal( 'f[<$text link="url">o</$text><$text bold="true" link="url">oba</$text>]<$text bold="true">r</$text>' );
+				expect( getData( document ) ).to.equal(
+					'f[<$text linkHref="url">o</$text>' +
+					'<$text bold="true" linkHref="url">oba</$text>]' +
+					'<$text bold="true">r</$text>'
+				);
 			} );
 
-			it( 'should overwrite existing link attribute when selected text wraps text with link attribute', () => {
-				setData( document, 'f[o<$text link="other url">o</$text>ba]r' );
+			it( 'should overwrite existing linkHref attribute when selected text wraps text with linkHref attribute', () => {
+				setData( document, 'f[o<$text linkHref="other url">o</$text>ba]r' );
 
 				expect( command.value ).to.undefined;
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) ).to.equal( 'f[<$text link="url">ooba</$text>]r' );
+				expect( getData( document ) ).to.equal( 'f[<$text linkHref="url">ooba</$text>]r' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should split text and overwrite attribute value when selection is inside text with link attribute', () => {
-				setData( document, 'f<$text link="other url">o[ob]a</$text>r' );
+			it( 'should split text and overwrite attribute value when selection is inside text with linkHref attribute', () => {
+				setData( document, 'f<$text linkHref="other url">o[ob]a</$text>r' );
 
 				expect( command.value ).to.equal( 'other url' );
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) )
-					.to.equal( 'f<$text link="other url">o</$text>[<$text link="url">ob</$text>]<$text link="other url">a</$text>r' );
+				expect( getData( document ) ).to.equal(
+					'f' +
+					'<$text linkHref="other url">o</$text>' +
+					'[<$text linkHref="url">ob</$text>]' +
+					'<$text linkHref="other url">a</$text>' +
+					'r'
+				);
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should overwrite link attribute of selected text only, when selection start inside text with link attribute', () => {
-				setData( document, 'f<$text link="other url">o[o</$text>ba]r' );
+			it(
+				'should overwrite linkHref attribute of selected text only, when selection start inside text with linkHref attribute',
+			() => {
+				setData( document, 'f<$text linkHref="other url">o[o</$text>ba]r' );
 
 				expect( command.value ).to.equal( 'other url' );
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) ).to.equal( 'f<$text link="other url">o</$text>[<$text link="url">oba</$text>]r' );
+				expect( getData( document ) ).to.equal( 'f<$text linkHref="other url">o</$text>[<$text linkHref="url">oba</$text>]r' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should overwrite link attribute of selected text only, when selection end inside text with link attribute', () => {
-				setData( document, 'f[o<$text link="other url">ob]a</$text>r' );
+			it( 'should overwrite linkHref attribute of selected text only, when selection end inside text with linkHref attribute', () => {
+				setData( document, 'f[o<$text linkHref="other url">ob]a</$text>r' );
 
 				expect( command.value ).to.undefined;
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) ).to.equal( 'f[<$text link="url">oob</$text>]<$text link="other url">a</$text>r' );
+				expect( getData( document ) ).to.equal( 'f[<$text linkHref="url">oob</$text>]<$text linkHref="other url">a</$text>r' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should set link attribute to selected text when text is split by $block element', () => {
+			it( 'should set linkHref attribute to selected text when text is split by $block element', () => {
 				setData( document, '<p>f[oo</p><p>ba]r</p>' );
 
 				expect( command.value ).to.undefined;
@@ -138,14 +148,14 @@ describe( 'LinkCommand', () => {
 				command._doExecute( 'url' );
 
 				expect( getData( document ) )
-					.to.equal( '<p>f[<$text link="url">oo</$text></p><p><$text link="url">ba</$text>]r</p>' );
+					.to.equal( '<p>f[<$text linkHref="url">oo</$text></p><p><$text linkHref="url">ba</$text>]r</p>' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should set link attribute only to allowed elements and omit disallowed', () => {
+			it( 'should set linkHref attribute only to allowed elements and omit disallowed', () => {
 				// Disallow text in img.
 				document.schema.registerItem( 'img', '$block' );
-				document.schema.disallow( { name: '$text', attributes: 'link', inside: 'img' } );
+				document.schema.disallow( { name: '$text', attributes: 'linkHref', inside: 'img' } );
 
 				setData( document, '<p>f[oo<img></img>ba]r</p>' );
 
@@ -154,31 +164,36 @@ describe( 'LinkCommand', () => {
 				command._doExecute( 'url' );
 
 				expect( getData( document ) )
-					.to.equal( '<p>f[<$text link="url">oo</$text><img></img><$text link="url">ba</$text>]r</p>' );
+					.to.equal( '<p>f[<$text linkHref="url">oo</$text><img></img><$text linkHref="url">ba</$text>]r</p>' );
 				expect( command.value ).to.equal( 'url' );
 			} );
 		} );
 
 		describe( 'collapsed selection', () => {
-			it( 'should insert text with link attribute and data equal to href', () => {
+			it( 'should insert text with linkHref attribute and data equal to href', () => {
 				setData( document, 'foo[]bar' );
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) ).to.equal( 'foo[<$text link="url">url</$text>]bar' );
+				expect( getData( document ) ).to.equal( 'foo[<$text linkHref="url">url</$text>]bar' );
 			} );
 
-			it( 'should insert text with link attribute and data equal to href when selection is inside text with link attribute', () => {
-				setData( document, '<$text link="other url">foo[]bar</$text>' );
+			it(
+				'should insert text with linkHref attribute and data equal to href when selection is inside text with linkHref attribute',
+			() => {
+				setData( document, '<$text linkHref="other url">foo[]bar</$text>' );
 
 				command._doExecute( 'url' );
 
-				expect( getData( document ) )
-					.to.equal( '<$text link="other url">foo</$text>[<$text link="url">url</$text>]<$text link="other url">bar</$text>' );
+				expect( getData( document ) ).to.equal(
+					'<$text linkHref="other url">foo</$text>' +
+					'[<$text linkHref="url">url</$text>]' +
+					'<$text linkHref="other url">bar</$text>'
+				);
 			} );
 
-			it( 'should not insert text with link attribute when is not allowed in parent', () => {
-				document.schema.disallow( { name: '$text', attributes: 'link', inside: 'p' } );
+			it( 'should not insert text with linkHref attribute when is not allowed in parent', () => {
+				document.schema.disallow( { name: '$text', attributes: 'linkHref', inside: 'p' } );
 				setData( document, '<p>foo[]bar</p>' );
 
 				command._doExecute( 'url' );
@@ -194,7 +209,7 @@ describe( 'LinkCommand', () => {
 
 		beforeEach( () => {
 			document.schema.registerItem( 'x', '$block' );
-			document.schema.disallow( { name: '$text', inside: 'x', attributes: 'link' } );
+			document.schema.disallow( { name: '$text', inside: 'x', attributes: 'linkHref' } );
 		} );
 
 		describe( 'when selection is collapsed', () => {

+ 4 - 4
packages/ckeditor5-link/tests/linkengine.js

@@ -31,7 +31,7 @@ describe( 'LinkEngine', () => {
 	} );
 
 	it( 'should set proper schema rules', () => {
-		expect( doc.schema.check( { name: '$inline', attributes: [ 'link' ] } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'linkHref' ] } ) ).to.be.true;
 	} );
 
 	describe( 'command', () => {
@@ -53,17 +53,17 @@ describe( 'LinkEngine', () => {
 	} );
 
 	describe( 'data pipeline conversions', () => {
-		it( 'should convert `<a href="url">` to `link="url"` attribute', () => {
+		it( 'should convert `<a href="url">` to `linkHref="url"` attribute', () => {
 			editor.setData( '<a href="url">foo</a>bar' );
 
-			expect( getModelData( doc, { withoutSelection: true } ) ).to.equal( '<$text link="url">foo</$text>bar' );
+			expect( getModelData( doc, { withoutSelection: true } ) ).to.equal( '<$text linkHref="url">foo</$text>bar' );
 			expect( editor.getData() ).to.equal( '<a href="url">foo</a>bar' );
 		} );
 	} );
 
 	describe( 'editing pipeline conversion', () => {
 		it( 'should convert attribute', () => {
-			setModelData( doc, '<$text link="url">foo</$text>bar' );
+			setModelData( doc, '<$text linkHref="url">foo</$text>bar' );
 
 			expect( getViewData( editor.editing.view, { withoutSelection: true } ) ).to.equal( '<a href="url">foo</a>bar' );
 		} );

+ 104 - 53
packages/ckeditor5-link/tests/unlinkcommand.js

@@ -20,9 +20,9 @@ describe( 'UnlinkCommand', () => {
 				// Allow text in $root.
 				document.schema.allow( { name: '$text', inside: '$root' } );
 
-				// Allow text with link attribute in paragraph.
+				// Allow text with `linkHref` attribute in paragraph.
 				document.schema.registerItem( 'p', '$block' );
-				document.schema.allow( { name: '$text', attributes: 'link', inside: '$root' } );
+				document.schema.allow( { name: '$text', attributes: 'linkHref', inside: '$root' } );
 			} );
 	} );
 
@@ -32,116 +32,167 @@ describe( 'UnlinkCommand', () => {
 
 	describe( '_doExecute', () => {
 		describe( 'non-collapsed selection', () => {
-			it( 'should remove link attribute from selected text', () => {
-				setData( document, '<$text link="url">f[ooba]r</$text>' );
+			it( 'should remove `linkHref` attribute from selected text', () => {
+				setData( document, '<$text linkHref="url">f[ooba]r</$text>' );
 
 				command._doExecute();
 
-				expect( getData( document ) ).to.equal( '<$text link="url">f</$text>[ooba]<$text link="url">r</$text>' );
+				expect( getData( document ) ).to.equal( '<$text linkHref="url">f</$text>[ooba]<$text linkHref="url">r</$text>' );
 			} );
 
-			it( 'should remove link attribute from selected text and do not modified other attributes', () => {
-				setData( document, '<$text bold="true" link="url">f[ooba]r</$text>' );
+			it( 'should remove `linkHref` attribute from selected text and do not modified other attributes', () => {
+				setData( document, '<$text bold="true" linkHref="url">f[ooba]r</$text>' );
 
 				command._doExecute();
 
-				expect( getData( document ) )
-					.to.equal( '<$text bold="true" link="url">f</$text>[<$text bold="true">ooba</$text>]<$text bold="true" link="url">r</$text>' );
+				expect( getData( document ) ).to.equal(
+					'<$text bold="true" linkHref="url">f</$text>' +
+					'[<$text bold="true">ooba</$text>]' +
+					'<$text bold="true" linkHref="url">r</$text>'
+				);
 			} );
 
-			it( 'should remove link attribute from selected text when attributes have different value', () => {
-				setData( document, '[<$text link="url">foo</$text><$text link="other url">bar</$text>]' );
+			it( 'should remove `linkHref` attribute from selected text when attributes have different value', () => {
+				setData( document, '[<$text linkHref="url">foo</$text><$text linkHref="other url">bar</$text>]' );
 
 				command._doExecute();
 
 				expect( getData( document ) ).to.equal( '[foobar]' );
 			} );
+
+			it( 'should remove `linkHref` attribute from selection', () => {
+				setData( document, '<$text linkHref="url">f[ooba]r</$text>' );
+
+				command._doExecute();
+
+				expect( document.selection.hasAttribute( 'linkHref' ) ).to.false;
+			} );
 		} );
 
 		describe( 'collapsed selection', () => {
-			it( 'should remove link attribute from selection siblings with the same attribute value', () => {
-				setData( document, '<$text link="url">foo[]bar</$text>' );
+			it( 'should remove `linkHref` attribute from selection siblings with the same attribute value', () => {
+				setData( document, '<$text linkHref="url">foo[]bar</$text>' );
 
 				command._doExecute();
 
 				expect( getData( document ) ).to.equal( 'foo[]bar' );
 			} );
 
-			it( 'should remove link attribute from selection siblings with the same attribute value and do not ' +
-				'modified other attributes',
+			it(
+				'should remove `linkHref` attribute from selection siblings with the same attribute value and do not modify other attributes',
 			() => {
-				setData( document, '<$text bold="true" link="url">foo[]bar</$text>' );
+				setData(
+					document,
+					'<$text linkHref="other url">fo</$text>' +
+					'<$text linkHref="url">o[]b</$text>' +
+					'<$text linkHref="other url">ar</$text>'
+				);
 
 				command._doExecute();
 
-				expect( getData( document ) ).to.equal( '<$text bold="true">foo[]bar</$text>' );
+				expect( getData( document ) ).to.equal(
+					'<$text linkHref="other url">fo</$text>' +
+					'o[]b' +
+					'<$text linkHref="other url">ar</$text>'
+				);
 			} );
 
-			it(
-				'should remove link attribute from selection siblings with the same attribute value and do nothing ' +
-				'with other value links',
-			() => {
-				setData( document, '<$text link="other url">fo</$text><$text link="url">o[]b</$text><$text link="other url">ar</$text>' );
+			it( 'should do nothing with nodes with the same `linkHref` value when there is a node with different value `linkHref` ' +
+				'attribute between', () => {
+				setData(
+					document,
+					'<$text linkHref="same url">f</$text>' +
+					'<$text linkHref="other url">o</$text>' +
+					'<$text linkHref="same url">o[]b</$text>' +
+					'<$text linkHref="other url">a</$text>' +
+					'<$text linkHref="same url">r</$text>'
+				);
 
 				command._doExecute();
 
-				expect( getData( document ) ).to.equal( '<$text link="other url">fo</$text>o[]b<$text link="other url">ar</$text>' );
+				expect( getData( document ) )
+					.to.equal(
+						'<$text linkHref="same url">f</$text>' +
+						'<$text linkHref="other url">o</$text>' +
+						'o[]b' +
+						'<$text linkHref="other url">a</$text>' +
+						'<$text linkHref="same url">r</$text>'
+					);
 			} );
 
-			it( 'should do nothing with the same value links when there is a link with other value between', () => {
-					setData(
-						document,
-						'<$text link="same url">f</$text>' +
-						'<$text link="other url">o</$text>' +
-						'<$text link="same url">o[]b</$text>' +
-						'<$text link="other url">a</$text>' +
-						'<$text link="same url">r</$text>'
-					);
+			it(
+				'should remove `linkHref` attribute from selection siblings with the same attribute value and do nothing with other ' +
+				'attributes',
+			() => {
+				setData(
+					document,
+					'<$text linkHref="url">f</$text>' +
+					'<$text bold="true" linkHref="url">o</$text>' +
+					'<$text linkHref="url">o[]b</$text>' +
+					'<$text bold="true" linkHref="url">a</$text>' +
+					'<$text linkHref="url">r</$text>'
+				);
 
-					command._doExecute();
+				command._doExecute();
 
-					expect( getData( document ) )
-						.to.equal(
-							'<$text link="same url">f</$text>' +
-							'<$text link="other url">o</$text>' +
-							'o[]b' +
-							'<$text link="other url">a</$text>' +
-							'<$text link="same url">r</$text>'
-						);
-				} );
+				expect( getData( document ) ).to.equal(
+					'f' +
+					'<$text bold="true">o</$text>' +
+					'o[]b' +
+					'<$text bold="true">a</$text>' +
+					'r'
+				);
+			} );
 
-			it( 'should remove link attribute from selection siblings only in the same parent as selection parent', () => {
-				setData( document, '<p><$text link="url">fo[]o</$text></p><p><$text link="url">bar</$text></p>' );
+			it( 'should remove `linkHref` attribute from selection siblings only in the same parent as selection parent', () => {
+				setData(
+					document,
+					'<p><$text linkHref="url">bar</$text></p>' +
+					'<p><$text linkHref="url">fo[]o</$text></p>' +
+					'<p><$text linkHref="url">bar</$text></p>'
+				);
 
 				command._doExecute();
 
-				expect( getData( document ) ).to.equal( '<p>fo[]o</p><p><$text link="url">bar</$text></p>' );
+				expect( getData( document ) ).to.equal(
+					'<p><$text linkHref="url">bar</$text></p>' +
+					'<p>fo[]o</p>' +
+					'<p><$text linkHref="url">bar</$text></p>'
+				);
 			} );
 
-			it( 'should remove link attribute from selection siblings when selection is at the end of link', () => {
-				setData( document, '<$text link="url">foobar</$text>[]' );
+			it( 'should remove `linkHref` attribute from selection siblings when selection is at the end of link', () => {
+				setData( document, '<$text linkHref="url">foobar</$text>[]' );
 
 				command._doExecute();
 
 				expect( getData( document ) ).to.equal( 'foobar[]' );
 			} );
 
-			it( 'should remove link attribute from selection siblings when selection is at the beginning of link', () => {
-				setData( document, '[]<$text link="url">foobar</$text>' );
+			it( 'should remove `linkHref` attribute from selection siblings when selection is at the beginning of link', () => {
+				setData( document, '[]<$text linkHref="url">foobar</$text>' );
 
 				command._doExecute();
 
 				expect( getData( document ) ).to.equal( '[]foobar' );
 			} );
 
-			it( 'should remove link attribute from selection siblings on the left side when selection is between two ' +
-				'elements with different link attributes',
+			it( 'should remove `linkHref` attribute from selection siblings on the left side when selection is between two elements with ' +
+				'different `linkHref` attributes',
 			() => {
-				setData( document, '<$text link="url">foo</$text>[]<$text link="other url">bar</$text>' );
+				setData( document, '<$text linkHref="url">foo</$text>[]<$text linkHref="other url">bar</$text>' );
+
+				command._doExecute();
+
+				expect( getData( document ) ).to.equal( 'foo[]<$text linkHref="other url">bar</$text>' );
+			} );
+
+			it( 'should remove `linkHref` attribute from selection', () => {
+				setData( document, '<$text linkHref="url">foo[]bar</$text>' );
 
 				command._doExecute();
 
-				expect( getData( document ) ).to.equal( 'foo[]<$text link="other url">bar</$text>' );
+				expect( document.selection.hasAttribute( 'linkHref' ) ).to.false;
 			} );
 		} );
 	} );