Parcourir la source

Merge branch 'master' into t/93a

Piotrek Koszuliński il y a 8 ans
Parent
commit
fd7e6c70eb

+ 12 - 0
packages/ckeditor5-link/.eslintrc.js

@@ -0,0 +1,12 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* eslint-env node */
+
+'use strict';
+
+module.exports = {
+	extends: 'ckeditor5'
+};

+ 0 - 92
packages/ckeditor5-link/.jscsrc

@@ -1,92 +0,0 @@
-{
-  "requireCurlyBraces": [
-    "if",
-    "else",
-    "for",
-    "while",
-    "do",
-    "switch",
-    "try",
-    "catch"
-  ],
-  "requireSpaceBeforeKeywords": true,
-  "requireSpaceAfterKeywords": [
-    "do",
-    "for",
-    "if",
-    "else",
-    "switch",
-    "case",
-    "try",
-    "catch",
-    "void",
-    "while",
-    "with",
-    "return",
-    "typeof"
-  ],
-  "requireSpaceBeforeBlockStatements": true,
-  "requireParenthesesAroundIIFE": true,
-  "requireSpacesInConditionalExpression": {
-    "afterTest": true,
-    "beforeConsequent": true,
-    "afterConsequent": true,
-    "beforeAlternate": true
-  },
-  "requireSpacesInFunction": {
-    "beforeOpeningCurlyBrace": true
-  },
-  "disallowSpacesInFunction": {
-    "beforeOpeningRoundBrace": true
-  },
-  "disallowSpacesInCallExpression": true,
-  "disallowMultipleVarDecl": "exceptUndefined",
-  "requireBlocksOnNewline": true,
-  "disallowPaddingNewlinesInBlocks": true,
-  "requirePaddingNewlinesBeforeKeywords": [
-    "do",
-    "for",
-    "if",
-    "switch",
-    "case",
-    "try",
-    "while",
-    "with",
-    "return"
-  ],
-  "requireSpacesInsideObjectBrackets": "all",
-  "requireSpacesInsideArrayBrackets": "all",
-  "requireSpacesInsideParentheses": "all",
-  "disallowSpaceAfterObjectKeys": true,
-  "requireSpaceBeforeObjectValues": true,
-  "requireCommaBeforeLineBreak": true,
-  "requireOperatorBeforeLineBreak": true,
-  "disallowSpaceAfterPrefixUnaryOperators": true,
-  "disallowSpaceBeforePostfixUnaryOperators": true,
-  "requireSpaceBeforeBinaryOperators": true,
-  "disallowImplicitTypeConversion": [
-    "numeric",
-    "binary",
-    "string"
-  ],
-  "requireCamelCaseOrUpperCaseIdentifiers": true,
-  "requireSpaceAfterBinaryOperators": true,
-  "disallowKeywords": [
-    "with"
-  ],
-  "disallowMultipleLineStrings": true,
-  "disallowMultipleLineBreaks": true,
-  "disallowMixedSpacesAndTabs": true,
-  "disallowTrailingWhitespace": true,
-  "maximumLineLength": 140,
-  "requireCapitalizedConstructors": true,
-  "requireDotNotation": true,
-  "disallowYodaConditions": true,
-  "disallowNewlineBeforeBlockStatements": true,
-  "validateLineBreaks": "LF",
-  "validateQuoteMarks": "'",
-  "validateIndentation": "\t",
-  "safeContextKeyword": [
-    "that"
-  ]
-}

+ 0 - 12
packages/ckeditor5-link/.jshintrc

@@ -1,12 +0,0 @@
-{
-  "browser": true,
-  "esnext": true,
-  "immed": true,
-  "loopfunc": true,
-  "noarg": true,
-  "nonbsp": true,
-  "undef": true,
-  "unused": true,
-  "strict": "implied",
-  "varstmt": true
-}

+ 6 - 5
packages/ckeditor5-link/gulpfile.js

@@ -3,19 +3,20 @@
  * For licensing, see LICENSE.md.
  */
 
-/* jshint browser: false, node: true, strict: true */
+/* eslint-env node */
 
 'use strict';
 
 const gulp = require( 'gulp' );
-const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )( {
+const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' );
+const options = {
 	// Files ignored by `gulp lint` task.
 	// Files from .gitignore will be added automatically during task execution.
 	ignoredFiles: [
 		'src/lib/**'
 	]
-} );
+};
 
-gulp.task( 'lint', ckeditor5Lint.lint );
-gulp.task( 'lint-staged', ckeditor5Lint.lintStaged );
+gulp.task( 'lint', () => ckeditor5Lint.lint( options ) );
+gulp.task( 'lint-staged', () => ckeditor5Lint.lintStaged( options ) );
 gulp.task( 'pre-commit', [ 'lint-staged' ] );

+ 3 - 2
packages/ckeditor5-link/package.json

@@ -10,7 +10,7 @@
     "@ckeditor/ckeditor5-ui": "^0.9.0"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-dev-lint": "^2.0.2",
+    "@ckeditor/ckeditor5-dev-lint": "^3.0.0",
     "@ckeditor/ckeditor5-editor-classic": "^0.7.3",
     "@ckeditor/ckeditor5-enter": "^0.9.1",
     "@ckeditor/ckeditor5-heading": "^0.9.1",
@@ -18,7 +18,8 @@
     "@ckeditor/ckeditor5-typing": "^0.9.1",
     "@ckeditor/ckeditor5-undo": "^0.8.1",
     "@ckeditor/ckeditor5-utils": "^0.9.1",
-    "gulp": "^3.9.0",
+    "eslint-config-ckeditor5": "^1.0.0",
+    "gulp": "^3.9.1",
     "guppy-pre-commit": "^0.4.0"
   },
   "engines": {

+ 57 - 23
packages/ckeditor5-link/src/link.js

@@ -9,6 +9,7 @@
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import ClickObserver from '@ckeditor/ckeditor5-engine/src/view/observer/clickobserver';
+import Range from '@ckeditor/ckeditor5-engine/src/view/range';
 import LinkEngine from './linkengine';
 import LinkElement from './linkelement';
 import ContextualBalloon from '@ckeditor/ckeditor5-ui/src/panel/balloon/contextualballoon';
@@ -125,7 +126,7 @@ export default class Link extends Plugin {
 		// Handle `Ctrl+K` keystroke and show the panel.
 		editor.keystrokes.set( 'CTRL+K', () => this._showPanel( true ) );
 
-		editor.ui.componentFactory.add( 'link', ( locale ) => {
+		editor.ui.componentFactory.add( 'link', locale => {
 			const button = new ButtonView( locale );
 
 			button.isEnabled = true;
@@ -155,7 +156,7 @@ export default class Link extends Plugin {
 		const t = editor.t;
 		const unlinkCommand = editor.commands.get( 'unlink' );
 
-		editor.ui.componentFactory.add( 'unlink', ( locale ) => {
+		editor.ui.componentFactory.add( 'unlink', locale => {
 			const button = new ButtonView( locale );
 
 			button.isEnabled = false;
@@ -185,11 +186,9 @@ export default class Link extends Plugin {
 		// Handle click on view document and show panel when selection is placed inside the link element.
 		// Keep panel open until selection will be inside the same link element.
 		this.listenTo( viewDocument, 'click', () => {
-			const viewSelection = viewDocument.selection;
 			const parentLink = this._getSelectedLinkElement();
 
-			// When collapsed selection is inside link element (link element is clicked).
-			if ( viewSelection.isCollapsed && parentLink ) {
+			if ( parentLink ) {
 				// Then show panel but keep focus inside editor editable.
 				this._showPanel();
 			}
@@ -229,7 +228,9 @@ export default class Link extends Plugin {
 	 * @return {Promise} A promise resolved when the {@link #formView} {@link module:ui/view~View#init} is done.
 	 */
 	_showPanel( focusInput ) {
-		const editing = this.editor.editing;
+		const editor = this.editor;
+		const command = editor.commands.get( 'link' );
+		const editing = editor.editing;
 		const showViewDocument = editing.view;
 		const showIsCollapsed = showViewDocument.selection.isCollapsed;
 		const showSelectedLink = this._getSelectedLinkElement();
@@ -237,6 +238,13 @@ export default class Link extends Plugin {
 		// https://github.com/ckeditor/ckeditor5-link/issues/53
 		this.formView.unlinkButtonView.isVisible = !!showSelectedLink;
 
+		// Make sure that each time the panel shows up, the URL field remains in sync with the value of
+		// the command. If the user typed in the input, then canceled the balloon (`urlInputView#value` stays
+		// unaltered) and re-opened it without changing the value of the link command (e.g. because they
+		// clicked the same link), they would see the old value instead of the actual value of the command.
+		// https://github.com/ckeditor/ckeditor5-link/issues/78
+		this.formView.urlInputView.inputView.element.value = command.value;
+
 		this.listenTo( showViewDocument, 'render', () => {
 			const renderSelectedLink = this._getSelectedLinkElement();
 			const renderIsCollapsed = showViewDocument.selection.isCollapsed;
@@ -275,13 +283,13 @@ export default class Link extends Plugin {
 			return Promise.resolve();
 		} else {
 			return this._balloon.add( {
-					view: this.formView,
-					position: this._getBalloonPositionData()
-				} ).then( () => {
-					if ( focusInput ) {
-						this.formView.urlInputView.select();
-					}
-				} );
+				view: this.formView,
+				position: this._getBalloonPositionData()
+			} ).then( () => {
+				if ( focusInput ) {
+					this.formView.urlInputView.select();
+				}
+			} );
 		}
 	}
 
@@ -324,8 +332,7 @@ export default class Link extends Plugin {
 
 		const target = targetLink ?
 			// When selection is inside link element, then attach panel to this element.
-			viewDocument.domConverter.getCorrespondingDomElement( targetLink )
-			:
+			viewDocument.domConverter.getCorrespondingDomElement( targetLink ) :
 			// Otherwise attach panel to the selection.
 			viewDocument.domConverter.viewRangeToDom( viewDocument.selection.getFirstRange() );
 
@@ -336,20 +343,47 @@ export default class Link extends Plugin {
 	}
 
 	/**
-	 * Returns the {@link module:link/linkelement~LinkElement} at the first
-	 * {@link module:engine/model/position~Position} of
+	 * Returns the {@link module:link/linkelement~LinkElement} under
 	 * {@link module:engine/view/document~Document editing view's} selection or `null`
 	 * if there's none.
 	 *
+	 * **Note**: For non–collapsed selection the `LinkElement` is only returned when **fully**
+	 * selected and the **only** element within the selection boundaries.
+	 *
 	 * @private
 	 * @returns {module:link/linkelement~LinkElement|null}
 	 */
 	_getSelectedLinkElement() {
-		return this.editor.editing.view
-			.selection
-			.getFirstPosition()
-			.parent
-			.getAncestors()
-			.find( ancestor => ancestor instanceof LinkElement );
+		const selection = this.editor.editing.view.selection;
+
+		if ( selection.isCollapsed ) {
+			return findLinkElementAncestor( selection.getFirstPosition() );
+		} else {
+			// The range for fully selected link is usually anchored in adjacent text nodes.
+			// Trim it to get closer to the actual LinkElement.
+			const range = selection.getFirstRange().getTrimmed();
+			const startLink = findLinkElementAncestor( range.start );
+			const endLink = findLinkElementAncestor( range.end );
+
+			if ( !startLink || startLink != endLink ) {
+				return null;
+			}
+
+			// Check if the LinkElement is fully selected.
+			if ( Range.createIn( startLink ).getTrimmed().isEqual( range ) ) {
+				return startLink;
+			} else {
+				return null;
+			}
+		}
 	}
 }
+
+// Returns a `LinkElement` if there's one among the ancestors of the provided `Position`.
+//
+// @private
+// @param {module:engine/view/position~Position} View position to analyze.
+// @returns {module:link/linkelement~LinkElement|null} LinkElement at the position or null.
+function findLinkElementAncestor( position ) {
+	return position.getAncestors().find( ancestor => ancestor instanceof LinkElement );
+}

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

@@ -59,10 +59,10 @@ export default class LinkCommand extends Command {
 	 * When selection is non-collapsed, then `linkHref` attribute will be applied to nodes inside selection, but only to
 	 * those nodes where `linkHref` attribute is allowed (disallowed nodes will be omitted).
 	 *
-	 * When selection is collapsed and is not inside text with `linkHref` attribute, then new {@link module:engine/model/text~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
-	 * the inserted text will equal `href` parameter. Selection will be updated to wrap just inserted text node.
+	 * When selection is collapsed and is not inside text with `linkHref` attribute, then
+	 * new {@link module:engine/model/text~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 the inserted text will equal `href` parameter. Selection will be updated to
+	 * wrap just inserted text node.
 	 *
 	 * When selection is collapsed and inside text with `linkHref` attribute, the attribute value will be updated.
 	 *
@@ -106,7 +106,7 @@ export default class LinkCommand extends Command {
 				// omitting nodes where `linkHref` attribute is disallowed.
 				const ranges = getSchemaValidRanges( 'linkHref', selection.getRanges(), document.schema );
 
-				for ( let range of ranges ) {
+				for ( const range of ranges ) {
 					batch.setAttribute( range, 'linkHref', href );
 				}
 			}

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

@@ -36,12 +36,12 @@ export default class LinkEngine extends Plugin {
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )
 			.fromAttribute( 'linkHref' )
-			.toElement( ( linkHref ) => new LinkElement( 'a', { href: linkHref } ) );
+			.toElement( linkHref => new LinkElement( 'a', { href: linkHref } ) );
 
 		// Build converter from view to model for data pipeline.
 		buildViewConverter().for( data.viewToModel )
 			.fromElement( 'a' )
-			.toAttribute( ( viewElement ) => ( {
+			.toAttribute( viewElement => ( {
 				key: 'linkHref',
 				value: viewElement.getAttribute( 'href' )
 			} ) );

+ 1 - 1
packages/ckeditor5-link/src/unlinkcommand.js

@@ -50,7 +50,7 @@ export default class UnlinkCommand extends Command {
 			const batch = document.batch();
 
 			// Remove `linkHref` attribute from specified ranges.
-			for ( let range of rangesToUnlink ) {
+			for ( const range of rangesToUnlink ) {
 				batch.removeAttribute( range, 'linkHref' );
 			}
 		} );

+ 0 - 23
packages/ckeditor5-link/tests/.jshintrc

@@ -1,23 +0,0 @@
-{
-  "browser": true,
-  "esnext": true,
-  "expr": true,
-  "immed": true,
-  "loopfunc": true,
-  "noarg": true,
-  "nonbsp": true,
-  "strict": "implied",
-  "undef": true,
-  "unused": true,
-  "varstmt": true,
-  "globals": {
-    "after": false,
-    "afterEach": false,
-    "before": false,
-    "beforeEach": false,
-    "describe": false,
-    "expect": false,
-    "it": false,
-    "sinon": false
-  }
-}

+ 72 - 21
packages/ckeditor5-link/tests/link.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
+/* globals document, Event */
 
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
@@ -162,7 +162,8 @@ describe( 'Link', () => {
 				} );
 		} );
 
-		it( 'should not focus the #formView when called with a `true` parameter while the balloon is opened but link form is not visible', () => {
+		it( 'should not focus the #formView when called with a `true` parameter while the balloon is opened but link ' +
+			'form is not visible', () => {
 			const spy = testUtils.sinon.spy( formView.urlInputView, 'select' );
 			const viewMock = {
 				ready: true,
@@ -214,6 +215,19 @@ describe( 'Link', () => {
 				} );
 		} );
 
+		// https://github.com/ckeditor/ckeditor5-link/issues/78
+		it( 'should make sure the URL input in the #formView always stays in sync with the value of the command', () => {
+			setModelData( editor.document, '<paragraph><$text linkHref="url">f[]oo</$text></paragraph>' );
+
+			// Mock some leftover value **in DOM**, e.g. after previous editing.
+			formView.urlInputView.inputView.element.value = 'leftover';
+
+			return linkFeature._showPanel()
+				.then( () => {
+					expect( formView.urlInputView.inputView.element.value ).to.equal( 'url' );
+				} );
+		} );
+
 		describe( 'when the document is rendering', () => {
 			it( 'should not duplicate #render listeners', () => {
 				const viewDocument = editor.editing.view;
@@ -235,7 +249,7 @@ describe( 'Link', () => {
 					} );
 			} );
 
-			//https://github.com/ckeditor/ckeditor5-link/issues/113
+			// https://github.com/ckeditor/ckeditor5-link/issues/113
 			it( 'updates the position of the panel – editing a link, then the selection remains in the link upon #render', () => {
 				const viewDocument = editor.editing.view;
 
@@ -257,7 +271,7 @@ describe( 'Link', () => {
 					} );
 			} );
 
-			//https://github.com/ckeditor/ckeditor5-link/issues/113
+			// https://github.com/ckeditor/ckeditor5-link/issues/113
 			it( 'updates the position of the panel – creating a new link, then the selection moved upon #render', () => {
 				const viewDocument = editor.editing.view;
 
@@ -282,7 +296,7 @@ describe( 'Link', () => {
 					} );
 			} );
 
-			//https://github.com/ckeditor/ckeditor5-link/issues/113
+			// https://github.com/ckeditor/ckeditor5-link/issues/113
 			it( 'hides of the panel – editing a link, then the selection moved out of the link upon #render', () => {
 				const viewDocument = editor.editing.view;
 
@@ -305,11 +319,14 @@ describe( 'Link', () => {
 					} );
 			} );
 
-			//https://github.com/ckeditor/ckeditor5-link/issues/113
+			// https://github.com/ckeditor/ckeditor5-link/issues/113
 			it( 'hides of the panel – editing a link, then the selection moved to another link upon #render', () => {
 				const viewDocument = editor.editing.view;
 
-				setModelData( editor.document, '<paragraph><$text linkHref="url">f[]oo</$text>bar<$text linkHref="url">b[]az</$text></paragraph>' );
+				setModelData(
+					editor.document,
+					'<paragraph><$text linkHref="url">f[]oo</$text>bar<$text linkHref="url">b[]az</$text></paragraph>'
+				);
 
 				return linkFeature._showPanel()
 					.then( () => {
@@ -328,7 +345,7 @@ describe( 'Link', () => {
 					} );
 			} );
 
-			//https://github.com/ckeditor/ckeditor5-link/issues/113
+			// https://github.com/ckeditor/ckeditor5-link/issues/113
 			it( 'hides the panel – editing a link, then the selection expands upon #render', () => {
 				const viewDocument = editor.editing.view;
 
@@ -582,43 +599,77 @@ describe( 'Link', () => {
 		} );
 
 		describe( 'clicking on editable', () => {
-			let observer;
+			let observer, spy;
 
 			beforeEach( () => {
 				observer = editor.editing.view.getObserver( ClickObserver );
-			} );
+				editor.document.schema.allow( { name: '$text', inside: '$root' } );
 
-			it( 'should open with not selected formView when collapsed selection is inside link element', () => {
 				// Method is stubbed because it returns internal promise which can't be returned in test.
-				const spy = testUtils.sinon.stub( linkFeature, '_showPanel', () => {} );
+				spy = testUtils.sinon.stub( linkFeature, '_showPanel', () => {} );
+			} );
 
-				editor.document.schema.allow( { name: '$text', inside: '$root' } );
+			it( 'should open with not selected formView when collapsed selection is inside link element', () => {
 				setModelData( editor.document, '<$text linkHref="url">fo[]o</$text>' );
 
 				observer.fire( 'click', { target: document.body } );
+				sinon.assert.calledWithExactly( spy );
+			} );
+
+			it( 'should open when selection exclusively encloses a LinkElement (#1)', () => {
+				setModelData( editor.document, '[<$text linkHref="url">foo</$text>]' );
 
+				observer.fire( 'click', { target: {} } );
 				sinon.assert.calledWithExactly( spy );
 			} );
 
-			it( 'should not open when selection is not inside link element', () => {
-				const showSpy = testUtils.sinon.stub( linkFeature, '_showPanel' );
+			it( 'should open when selection exclusively encloses a LinkElement (#2)', () => {
+				setModelData( editor.document, '<$text linkHref="url">[foo]</$text>' );
+
+				observer.fire( 'click', { target: {} } );
+				sinon.assert.calledWithExactly( spy );
+			} );
 
+			it( 'should not open when selection is not inside link element', () => {
 				setModelData( editor.document, '[]' );
 
 				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
+			} );
 
-				sinon.assert.notCalled( showSpy );
+			it( 'should not open when selection is non-collapsed and doesn\'t enclose a LinkElement (#1)', () => {
+				setModelData( editor.document, '<$text linkHref="url">f[o]o</$text>' );
+
+				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
 			} );
 
-			it( 'should not open when selection is non-collapsed', () => {
-				const showSpy = testUtils.sinon.stub( linkFeature, '_showPanel' );
+			it( 'should not open when selection is non-collapsed and doesn\'t enclose a LinkElement (#2)', () => {
+				setModelData( editor.document, '<$text linkHref="url">[fo]o</$text>' );
 
-				editor.document.schema.allow( { name: '$text', inside: '$root' } );
-				setModelData( editor.document, '<$text linkHref="url">f[o]o</$text>' );
+				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
+			} );
+
+			it( 'should not open when selection is non-collapsed and doesn\'t enclose a LinkElement (#3)', () => {
+				setModelData( editor.document, '<$text linkHref="url">f[oo]</$text>' );
+
+				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
+			} );
+
+			it( 'should not open when selection is non-collapsed and doesn\'t enclose a LinkElement (#4)', () => {
+				setModelData( editor.document, 'ba[r<$text linkHref="url">foo]</$text>' );
 
 				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
+			} );
 
-				sinon.assert.notCalled( showSpy );
+			it( 'should not open when selection is non-collapsed and doesn\'t enclose a LinkElement (#5)', () => {
+				setModelData( editor.document, 'ba[r<$text linkHref="url">foo</$text>]' );
+
+				observer.fire( 'click', { target: {} } );
+				sinon.assert.notCalled( spy );
 			} );
 		} );
 	} );

+ 4 - 3
packages/ckeditor5-link/tests/linkcommand.js

@@ -34,13 +34,13 @@ describe( 'LinkCommand', () => {
 	describe( 'value', () => {
 		describe( 'collapsed selection', () => {
 			it( 'should be equal attribute value when selection is placed inside element with `linkHref` attribute', () => {
-				setData( document, `<$text linkHref="url">foo[]bar</$text>` );
+				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 `linkHref` attribute', () => {
-				setData( document, `<$text bold="true">foo[]bar</$text>` );
+				setData( document, '<$text bold="true">foo[]bar</$text>' );
 
 				expect( command.value ).to.undefined;
 			} );
@@ -130,7 +130,8 @@ describe( 'LinkCommand', () => {
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it( 'should overwrite `linkHref` attribute of selected text only, when selection end inside text with `linkHref` attribute', () => {
+			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;

+ 1 - 3
packages/ckeditor5-link/tests/linkengine.js

@@ -17,9 +17,7 @@ describe( 'LinkEngine', () => {
 	let editor, doc;
 
 	beforeEach( () => {
-		return VirtualTestEditor.create( {
-				plugins: [ Paragraph, LinkEngine ]
-			} )
+		return VirtualTestEditor.create( { plugins: [ Paragraph, LinkEngine ] } )
 			.then( newEditor => {
 				editor = newEditor;
 

+ 4 - 4
packages/ckeditor5-link/tests/manual/tickets/113/1.js

@@ -44,7 +44,7 @@ ClassicEditor.create( document.querySelector( '#editor-delete' ), {
 .catch( err => console.error( err.stack ) );
 
 function wait( delay ) {
-	return new Promise( ( resolve ) => {
+	return new Promise( resolve => {
 		setTimeout( () => resolve(), delay );
 	} );
 }
@@ -54,7 +54,7 @@ function startExternalInsert( editor ) {
 	const bath = document.batch( 'transparent' );
 
 	function type( path, text ) {
-		return new Promise( ( resolve ) => {
+		return new Promise( resolve => {
 			let position = new Position( document.getRoot(), path );
 			let index = 0;
 
@@ -64,7 +64,7 @@ function startExternalInsert( editor ) {
 						bath.insert( position, new Text( text[ index ] ) );
 						position = position.getShiftedBy( 1 );
 
-						let nextLetter = text[ ++index ];
+						const nextLetter = text[ ++index ];
 
 						if ( nextLetter ) {
 							typing( nextLetter );
@@ -91,7 +91,7 @@ function startExternalInsert( editor ) {
 	}
 
 	wait( 3000 )
-		.then( () => type( [ 0, 36 ], `This specification defines the 5th major revision of the core language of the World Wide Web. ` ) )
+		.then( () => type( [ 0, 36 ], 'This specification defines the 5th major revision of the core language of the World Wide Web. ' ) )
 		.then( () => insertNewLine( [ 0 ] ) )
 		.then( () => type( [ 0, 0 ], 'a' ) )
 		.then( () => insertNewLine( [ 1 ] ) )

+ 3 - 1
packages/ckeditor5-link/tests/ui/linkformview.js

@@ -3,6 +3,8 @@
  * For licensing, see LICENSE.md.
  */
 
+/* globals Event */
+
 import LinkFormView from '../../src/ui/linkformview';
 import View from '@ckeditor/ckeditor5-ui/src/view';
 import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
@@ -18,7 +20,7 @@ describe( 'LinkFormView', () => {
 	let view;
 
 	beforeEach( () => {
-		view = new LinkFormView( { t: ( val ) => val } );
+		view = new LinkFormView( { t: val => val } );
 
 		return view.init();
 	} );

+ 2 - 3
packages/ckeditor5-link/tests/unlinkcommand.js

@@ -91,9 +91,8 @@ describe( 'UnlinkCommand', () => {
 				expect( getData( document ) ).to.equal( 'foo[]bar' );
 			} );
 
-			it(
-				'should remove `linkHref` attribute from selection siblings with the same attribute value and do not modify other attributes',
-			() => {
+			it( 'should remove `linkHref` attribute from selection siblings with the same attribute value and do not modify ' +
+				'other attributes', () => {
 				setData(
 					document,
 					'<$text linkHref="other url">fo</$text>' +