瀏覽代碼

Merge pull request #65 from ckeditor/t/ckeditor5/488

Other: Align feature class naming to a new scheme.
Szymon Cofalik 7 年之前
父節點
當前提交
8dee41bff3
共有 30 個文件被更改,包括 798 次插入641 次删除
  1. 6 38
      packages/ckeditor5-basic-styles/src/bold.js
  2. 7 5
      packages/ckeditor5-basic-styles/src/boldengine.js
  3. 50 0
      packages/ckeditor5-basic-styles/src/bold/boldui.js
  4. 6 33
      packages/ckeditor5-basic-styles/src/code.js
  5. 4 4
      packages/ckeditor5-basic-styles/src/codeengine.js
  6. 51 0
      packages/ckeditor5-basic-styles/src/code/codeui.js
  7. 6 38
      packages/ckeditor5-basic-styles/src/italic.js
  8. 9 6
      packages/ckeditor5-basic-styles/src/italicengine.js
  9. 50 0
      packages/ckeditor5-basic-styles/src/italic/italicui.js
  10. 6 38
      packages/ckeditor5-basic-styles/src/strikethrough.js
  11. 8 5
      packages/ckeditor5-basic-styles/src/strikethroughengine.js
  12. 50 0
      packages/ckeditor5-basic-styles/src/strikethrough/strikethroughui.js
  13. 6 38
      packages/ckeditor5-basic-styles/src/underline.js
  14. 9 6
      packages/ckeditor5-basic-styles/src/underlineengine.js
  15. 50 0
      packages/ckeditor5-basic-styles/src/underline/underlineui.js
  16. 6 86
      packages/ckeditor5-basic-styles/tests/bold.js
  17. 22 5
      packages/ckeditor5-basic-styles/tests/boldengine.js
  18. 73 0
      packages/ckeditor5-basic-styles/tests/bold/boldui.js
  19. 6 64
      packages/ckeditor5-basic-styles/tests/code.js
  20. 5 5
      packages/ckeditor5-basic-styles/tests/codeengine.js
  21. 68 0
      packages/ckeditor5-basic-styles/tests/code/codeui.js
  22. 6 84
      packages/ckeditor5-basic-styles/tests/italic.js
  23. 5 5
      packages/ckeditor5-basic-styles/tests/italicengine.js
  24. 88 0
      packages/ckeditor5-basic-styles/tests/italic/italicui.js
  25. 6 87
      packages/ckeditor5-basic-styles/tests/strikethrough.js
  26. 5 5
      packages/ckeditor5-basic-styles/tests/strikethroughengine.js
  27. 91 0
      packages/ckeditor5-basic-styles/tests/strikethrough/strikethroughui.js
  28. 6 84
      packages/ckeditor5-basic-styles/tests/underline.js
  29. 5 5
      packages/ckeditor5-basic-styles/tests/underlineengine.js
  30. 88 0
      packages/ckeditor5-basic-styles/tests/underline/underlineui.js

+ 6 - 38
packages/ckeditor5-basic-styles/src/bold.js

@@ -8,14 +8,14 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import BoldEngine from './boldengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import boldIcon from '../theme/icons/bold.svg';
+import BoldEditing from './bold/boldediting';
+import BoldUI from './bold/boldui';
 
 /**
- * The bold feature. It introduces the Bold button and the <kbd>Ctrl+B</kbd> keystroke.
+ * The bold feature.
  *
- * It uses the {@link module:basic-styles/boldengine~BoldEngine bold engine feature}.
+ * It loads the {@link module:basic-styles/bold/boldediting~BoldEditing bold editing feature}
+ * and {@link module:basic-styles/bold/boldui~BoldUI bold UI feature}.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -24,7 +24,7 @@ export default class Bold extends Plugin {
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ BoldEngine ];
+		return [ BoldEditing, BoldUI ];
 	}
 
 	/**
@@ -33,36 +33,4 @@ export default class Bold extends Plugin {
 	static get pluginName() {
 		return 'Bold';
 	}
-
-	/**
-	 * @inheritDoc
-	 */
-	init() {
-		const editor = this.editor;
-		const t = editor.t;
-		const command = editor.commands.get( 'bold' );
-		const keystroke = 'CTRL+B';
-
-		// Add bold button to feature components.
-		editor.ui.componentFactory.add( 'bold', locale => {
-			const view = new ButtonView( locale );
-
-			view.set( {
-				label: t( 'Bold' ),
-				icon: boldIcon,
-				keystroke,
-				tooltip: true
-			} );
-
-			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
-
-			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'bold' ) );
-
-			return view;
-		} );
-
-		// Set the Ctrl+B keystroke.
-		editor.keystrokes.set( keystroke, 'bold' );
-	}
 }

+ 7 - 5
packages/ckeditor5-basic-styles/src/boldengine.js

@@ -4,29 +4,28 @@
  */
 
 /**
- * @module basic-styles/boldengine
+ * @module basic-styles/bold/boldediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import AttributeCommand from './attributecommand';
+import AttributeCommand from '../attributecommand';
 
 const BOLD = 'bold';
 
 /**
- * The bold engine feature.
+ * The bold editing feature.
  *
  * It registers the `bold` command and introduces the `bold` attribute in the model which renders to the view
  * as a `<strong>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class BoldEngine extends Plugin {
+export default class BoldEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
 	init() {
 		const editor = this.editor;
-
 		// Allow bold attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: BOLD } );
 
@@ -47,5 +46,8 @@ export default class BoldEngine extends Plugin {
 
 		// Create bold command.
 		editor.commands.add( BOLD, new AttributeCommand( editor, BOLD ) );
+
+		// Set the Ctrl+B keystroke.
+		editor.keystrokes.set( 'CTRL+B', BOLD );
 	}
 }

+ 50 - 0
packages/ckeditor5-basic-styles/src/bold/boldui.js

@@ -0,0 +1,50 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module basic-styles/bold/boldui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import boldIcon from '../../theme/icons/bold.svg';
+
+const BOLD = 'bold';
+
+/**
+ * The bold UI feature. It introduces the Bold button.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class BoldUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const t = editor.t;
+
+		// Add bold button to feature components.
+		editor.ui.componentFactory.add( BOLD, locale => {
+			const command = editor.commands.get( BOLD );
+			const view = new ButtonView( locale );
+
+			view.set( {
+				label: t( 'Bold' ),
+				icon: boldIcon,
+				keystroke: 'CTRL+B',
+				tooltip: true
+			} );
+
+			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
+
+			// Execute command.
+			this.listenTo( view, 'execute', () => editor.execute( BOLD ) );
+
+			return view;
+		} );
+	}
+}

+ 6 - 33
packages/ckeditor5-basic-styles/src/code.js

@@ -8,16 +8,16 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import CodeEngine from './codeengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import codeIcon from '../theme/icons/code.svg';
+import CodeEditing from './code/codeediting';
+import CodeUI from './code/codeui';
 
 import '../theme/code.css';
 
 /**
- * The code feature. It introduces the Code button.
+ * The code feature.
  *
- * It uses the {@link module:basic-styles/codeengine~CodeEngine code engine feature}.
+ * It loads the {@link module:basic-styles/code/codeediting~CodeEditing code editing feature}
+ * and {@link module:basic-styles/code/codeui~CodeUI code UI feature}.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -26,7 +26,7 @@ export default class Code extends Plugin {
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ CodeEngine ];
+		return [ CodeEditing, CodeUI ];
 	}
 
 	/**
@@ -35,31 +35,4 @@ export default class Code extends Plugin {
 	static get pluginName() {
 		return 'Code';
 	}
-
-	/**
-	 * @inheritDoc
-	 */
-	init() {
-		const editor = this.editor;
-		const t = editor.t;
-		const command = editor.commands.get( 'code' );
-
-		// Add code button to feature components.
-		editor.ui.componentFactory.add( 'code', locale => {
-			const view = new ButtonView( locale );
-
-			view.set( {
-				label: t( 'Code' ),
-				icon: codeIcon,
-				tooltip: true
-			} );
-
-			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
-
-			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'code' ) );
-
-			return view;
-		} );
-	}
 }

+ 4 - 4
packages/ckeditor5-basic-styles/src/codeengine.js

@@ -4,23 +4,23 @@
  */
 
 /**
- * @module basic-styles/codeengine
+ * @module basic-styles/code/codeediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import AttributeCommand from './attributecommand';
+import AttributeCommand from '../attributecommand';
 
 const CODE = 'code';
 
 /**
- * The code engine feature.
+ * The code editing feature.
  *
  * It registers the `code` command and introduces the `code` attribute in the model which renders to the view
  * as a `<code>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class CodeEngine extends Plugin {
+export default class CodeEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */

+ 51 - 0
packages/ckeditor5-basic-styles/src/code/codeui.js

@@ -0,0 +1,51 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module basic-styles/code/codeui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import codeIcon from '../../theme/icons/code.svg';
+
+import '../../theme/code.css';
+
+const CODE = 'code';
+
+/**
+ * The code UI feature. It introduces the Code button.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class CodeUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const t = editor.t;
+
+		// Add code button to feature components.
+		editor.ui.componentFactory.add( CODE, locale => {
+			const command = editor.commands.get( CODE );
+			const view = new ButtonView( locale );
+
+			view.set( {
+				label: t( 'Code' ),
+				icon: codeIcon,
+				tooltip: true
+			} );
+
+			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
+
+			// Execute command.
+			this.listenTo( view, 'execute', () => editor.execute( CODE ) );
+
+			return view;
+		} );
+	}
+}

+ 6 - 38
packages/ckeditor5-basic-styles/src/italic.js

@@ -8,14 +8,14 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import ItalicEngine from './italicengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import italicIcon from '../theme/icons/italic.svg';
+import ItalicEditing from './italic/italicediting';
+import ItalicUI from './italic/italicui';
 
 /**
- * The italic feature. It introduces the Italic button and the <kbd>Ctrl+I</kbd> keystroke.
+ * The italic feature.
  *
- * It uses the {@link module:basic-styles/italicengine~ItalicEngine italic engine feature}.
+ * It loads the {@link module:basic-styles/italic/italicediting~ItalicEditing} and
+ * {@link module:basic-styles/italic/italicui~ItalicUI} plugins.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -24,7 +24,7 @@ export default class Italic extends Plugin {
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ ItalicEngine ];
+		return [ ItalicEditing, ItalicUI ];
 	}
 
 	/**
@@ -33,36 +33,4 @@ export default class Italic extends Plugin {
 	static get pluginName() {
 		return 'Italic';
 	}
-
-	/**
-	 * @inheritDoc
-	 */
-	init() {
-		const editor = this.editor;
-		const t = editor.t;
-		const command = editor.commands.get( 'italic' );
-		const keystroke = 'CTRL+I';
-
-		// Add bold button to feature components.
-		editor.ui.componentFactory.add( 'italic', locale => {
-			const view = new ButtonView( locale );
-
-			view.set( {
-				label: t( 'Italic' ),
-				icon: italicIcon,
-				keystroke,
-				tooltip: true
-			} );
-
-			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
-
-			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'italic' ) );
-
-			return view;
-		} );
-
-		// Set the Ctrl+I keystroke.
-		editor.keystrokes.set( keystroke, 'italic' );
-	}
 }

+ 9 - 6
packages/ckeditor5-basic-styles/src/italicengine.js

@@ -4,23 +4,23 @@
  */
 
 /**
- * @module basic-styles/italicengine
+ * @module basic-styles/italic/italicediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import AttributeCommand from './attributecommand';
+import AttributeCommand from '../attributecommand';
 
 const ITALIC = 'italic';
 
 /**
- * The italic engine feature.
+ * The italic editing feature.
  *
- * It registers the `italic` command and introduces the `italic` attribute in the model which renders to the view
- * as an `<em>` element.
+ * It registers the `italic` command, the <kbd>Ctrl+I</kbd> keystroke and introduces the `italic` attribute in the model
+ * which renders to the view as an `<em>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class ItalicEngine extends Plugin {
+export default class ItalicEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
@@ -45,5 +45,8 @@ export default class ItalicEngine extends Plugin {
 
 		// Create italic command.
 		editor.commands.add( ITALIC, new AttributeCommand( editor, ITALIC ) );
+
+		// Set the Ctrl+I keystroke.
+		editor.keystrokes.set( 'CTRL+I', ITALIC );
 	}
 }

+ 50 - 0
packages/ckeditor5-basic-styles/src/italic/italicui.js

@@ -0,0 +1,50 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module basic-styles/italic/italicui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import italicIcon from '../../theme/icons/italic.svg';
+
+const ITALIC = 'italic';
+
+/**
+ * The italic UI feature. It introduces the Italic button.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class ItalicUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const t = editor.t;
+
+		// Add bold button to feature components.
+		editor.ui.componentFactory.add( ITALIC, locale => {
+			const command = editor.commands.get( ITALIC );
+			const view = new ButtonView( locale );
+
+			view.set( {
+				label: t( 'Italic' ),
+				icon: italicIcon,
+				keystroke: 'CTRL+I',
+				tooltip: true
+			} );
+
+			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
+
+			// Execute command.
+			this.listenTo( view, 'execute', () => editor.execute( ITALIC ) );
+
+			return view;
+		} );
+	}
+}

+ 6 - 38
packages/ckeditor5-basic-styles/src/strikethrough.js

@@ -8,14 +8,14 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import StrikethroughEngine from './strikethroughengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import strikethroughIcon from '../theme/icons/strikethrough.svg';
+import StrikethroughEditing from './strikethrough/strikethroughediting';
+import StrikethroughUI from './strikethrough/strikethroughui';
 
 /**
- * The strikethrough feature. It introduces the Strikethrough button and the <kbd>Ctrl+Shift+X</kbd> keystroke.
+ * The strikethrough feature.
  *
- * It uses the {@link module:basic-styles/strikethroughengine~StrikethroughEngine strikethrough engine feature}.
+ * It loads the {@link module:basic-styles/strikethrough/strikethroughediting~StrikethroughEditing} and
+ * {@link module:basic-styles/strikethrough/strikethroughui~StrikethroughUI} plugins.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -24,7 +24,7 @@ export default class Strikethrough extends Plugin {
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ StrikethroughEngine ];
+		return [ StrikethroughEditing, StrikethroughUI ];
 	}
 
 	/**
@@ -33,36 +33,4 @@ export default class Strikethrough extends Plugin {
 	static get pluginName() {
 		return 'Strikethrough';
 	}
-
-	/**
-	 * @inheritDoc
-	 */
-	init() {
-		const editor = this.editor;
-		const t = editor.t;
-		const command = editor.commands.get( 'strikethrough' );
-		const keystroke = 'CTRL+SHIFT+X';
-
-		// Add strikethrough button to feature components.
-		editor.ui.componentFactory.add( 'strikethrough', locale => {
-			const view = new ButtonView( locale );
-
-			view.set( {
-				label: t( 'Strikethrough' ),
-				icon: strikethroughIcon,
-				keystroke,
-				tooltip: true
-			} );
-
-			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
-
-			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'strikethrough' ) );
-
-			return view;
-		} );
-
-		// Set the Ctrl+Shift+X keystroke.
-		editor.keystrokes.set( keystroke, 'strikethrough' );
-	}
 }

+ 8 - 5
packages/ckeditor5-basic-styles/src/strikethroughengine.js

@@ -4,24 +4,24 @@
  */
 
 /**
- * @module basic-styles/strikethroughengine
+ * @module basic-styles/strikethrough/strikethroughediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import AttributeCommand from './attributecommand';
+import AttributeCommand from '../attributecommand';
 
 const STRIKETHROUGH = 'strikethrough';
 
 /**
- * The strikethrough engine feature.
+ * The strikethrough editing feature.
  *
- * It registers the `strikethrough` command and introduces the
+ * It registers the `strikethrough` command, the <kbd>Ctrl+Shift+X</kbd> keystroke and introduces the
  * `strikethroughsthrough` attribute in the model which renders to the view
  * as a `<s>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class StrikethroughEngine extends Plugin {
+export default class StrikethroughEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
@@ -47,5 +47,8 @@ export default class StrikethroughEngine extends Plugin {
 
 		// Create strikethrough command.
 		editor.commands.add( STRIKETHROUGH, new AttributeCommand( editor, STRIKETHROUGH ) );
+
+		// Set the Ctrl+Shift+X keystroke.
+		editor.keystrokes.set( 'CTRL+SHIFT+X', 'strikethrough' );
 	}
 }

+ 50 - 0
packages/ckeditor5-basic-styles/src/strikethrough/strikethroughui.js

@@ -0,0 +1,50 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module basic-styles/strikethrough/strikethroughui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import strikethroughIcon from '../../theme/icons/strikethrough.svg';
+
+const STRIKETHROUGH = 'strikethrough';
+
+/**
+ * The strikethrough UI feature. It introduces the Strikethrough button.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class StrikethroughUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const t = editor.t;
+
+		// Add strikethrough button to feature components.
+		editor.ui.componentFactory.add( STRIKETHROUGH, locale => {
+			const command = editor.commands.get( STRIKETHROUGH );
+			const view = new ButtonView( locale );
+
+			view.set( {
+				label: t( 'Strikethrough' ),
+				icon: strikethroughIcon,
+				keystroke: 'CTRL+SHIFT+X',
+				tooltip: true
+			} );
+
+			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
+
+			// Execute command.
+			this.listenTo( view, 'execute', () => editor.execute( STRIKETHROUGH ) );
+
+			return view;
+		} );
+	}
+}

+ 6 - 38
packages/ckeditor5-basic-styles/src/underline.js

@@ -8,14 +8,14 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import UnderlineEngine from './underlineengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import underlineIcon from '../theme/icons/underline.svg';
+import UnderlineEditing from './underline/underlineediting';
+import UnderlineUI from './underline/underlineui';
 
 /**
- * The underline feature. It introduces the Underline button and the <kbd>Ctrl+U</kbd> keystroke.
+ * The underline feature.
  *
- * It uses the {@link module:basic-styles/underlineengine~UnderlineEngine underline engine feature}.
+ * It loads the {@link module:basic-styles/underline/underlineediting~UnderlineEditing} and
+ * {@link module:basic-styles/underline/underlineui~UnderlineUI} plugins.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -24,7 +24,7 @@ export default class Underline extends Plugin {
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ UnderlineEngine ];
+		return [ UnderlineEditing, UnderlineUI ];
 	}
 
 	/**
@@ -33,36 +33,4 @@ export default class Underline extends Plugin {
 	static get pluginName() {
 		return 'Underline';
 	}
-
-	/**
-	 * @inheritDoc
-	 */
-	init() {
-		const editor = this.editor;
-		const t = editor.t;
-		const command = editor.commands.get( 'underline' );
-		const keystroke = 'CTRL+U';
-
-		// Add bold button to feature components.
-		editor.ui.componentFactory.add( 'underline', locale => {
-			const view = new ButtonView( locale );
-
-			view.set( {
-				label: t( 'Underline' ),
-				icon: underlineIcon,
-				keystroke,
-				tooltip: true
-			} );
-
-			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
-
-			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'underline' ) );
-
-			return view;
-		} );
-
-		// Set the Ctrl+U keystroke.
-		editor.keystrokes.set( keystroke, 'underline' );
-	}
 }

+ 9 - 6
packages/ckeditor5-basic-styles/src/underlineengine.js

@@ -4,23 +4,23 @@
  */
 
 /**
- * @module basic-styles/underlineengine
+ * @module basic-styles/underline/underlineediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import AttributeCommand from './attributecommand';
+import AttributeCommand from '../attributecommand';
 
 const UNDERLINE = 'underline';
 
 /**
- * The underline engine feature.
+ * The underline editing feature.
  *
- * It registers the `underline` command and introduces the `underline` attribute in the model which renders to the view
- * as an `<u>` element.
+ * It registers the `underline` command, the <kbd>Ctrl+U</kbd> keystroke
+ * and introduces the `underline` attribute in the model which renders to the view as an `<u>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class UnderlineEngine extends Plugin {
+export default class UnderlineEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
@@ -42,5 +42,8 @@ export default class UnderlineEngine extends Plugin {
 
 		// Create underline command.
 		editor.commands.add( UNDERLINE, new AttributeCommand( editor, UNDERLINE ) );
+
+		// Set the Ctrl+U keystroke.
+		editor.keystrokes.set( 'CTRL+U', 'underline' );
 	}
 }

+ 50 - 0
packages/ckeditor5-basic-styles/src/underline/underlineui.js

@@ -0,0 +1,50 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module basic-styles/underline/underlineui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+
+import underlineIcon from '../../theme/icons/underline.svg';
+
+const UNDERLINE = 'underline';
+
+/**
+ * The underline UI feature. It introduces the Underline button.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class UnderlineUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const t = editor.t;
+
+		// Add bold button to feature components.
+		editor.ui.componentFactory.add( UNDERLINE, locale => {
+			const command = editor.commands.get( UNDERLINE );
+			const view = new ButtonView( locale );
+
+			view.set( {
+				label: t( 'Underline' ),
+				icon: underlineIcon,
+				keystroke: 'CTRL+U',
+				tooltip: true
+			} );
+
+			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
+
+			// Execute command.
+			this.listenTo( view, 'execute', () => editor.execute( UNDERLINE ) );
+
+			return view;
+		} );
+	}
+}

+ 6 - 86
packages/ckeditor5-basic-styles/tests/bold.js

@@ -3,96 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Bold from '../src/bold';
-import BoldEngine from '../src/boldengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
-
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-
-testUtils.createSinonSandbox();
+import BoldEditing from '../src/bold/boldediting';
+import BoldUI from '../src/bold/boldui';
 
 describe( 'Bold', () => {
-	let editor, boldView;
-
-	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
-		document.body.appendChild( editorElement );
-
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-
-				boldView = editor.ui.componentFactory.create( 'bold' );
-			} );
-	} );
-
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Bold ) ).to.be.instanceOf( Bold );
-	} );
-
-	it( 'should load BoldEngine', () => {
-		expect( editor.plugins.get( BoldEngine ) ).to.be.instanceOf( BoldEngine );
-	} );
-
-	it( 'should register bold feature component', () => {
-		expect( boldView ).to.be.instanceOf( ButtonView );
-		expect( boldView.isOn ).to.be.false;
-		expect( boldView.label ).to.equal( 'Bold' );
-		expect( boldView.icon ).to.match( /<svg / );
-		expect( boldView.keystroke ).to.equal( 'CTRL+B' );
+	it( 'should require BoldEditing and BoldUI', () => {
+		expect( Bold.requires ).to.deep.equal( [ BoldEditing, BoldUI ] );
 	} );
 
-	it( 'should execute bold command on model execute event', () => {
-		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-
-		boldView.fire( 'execute' );
-
-		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'bold' );
-	} );
-
-	it( 'should bind model to bold command', () => {
-		const command = editor.commands.get( 'bold' );
-
-		expect( boldView.isOn ).to.be.false;
-		expect( boldView.isEnabled ).to.be.true;
-
-		command.value = true;
-		expect( boldView.isOn ).to.be.true;
-
-		command.isEnabled = false;
-		expect( boldView.isEnabled ).to.be.false;
-	} );
-
-	it( 'should set keystroke in the model', () => {
-		expect( boldView.keystroke ).to.equal( 'CTRL+B' );
-	} );
-
-	it( 'should set editor keystroke', () => {
-		const spy = sinon.spy( editor, 'execute' );
-		const keyEventData = {
-			keyCode: keyCodes.b,
-			ctrlKey: true,
-			preventDefault: sinon.spy(),
-			stopPropagation: sinon.spy()
-		};
-
-		const wasHandled = editor.keystrokes.press( keyEventData );
-
-		expect( wasHandled ).to.be.true;
-		expect( spy.calledOnce ).to.be.true;
-		expect( keyEventData.preventDefault.calledOnce ).to.be.true;
+	it( 'should be named', () => {
+		expect( Bold.pluginName ).to.equal( 'Bold' );
 	} );
 } );

+ 22 - 5
packages/ckeditor5-basic-styles/tests/boldengine.js

@@ -3,22 +3,23 @@
  * For licensing, see LICENSE.md.
  */
 
-import BoldEngine from '../src/boldengine';
+import BoldEditing from '../../src/bold/boldediting';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import AttributeCommand from '../src/attributecommand';
+import AttributeCommand from '../../src/attributecommand';
 
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
+import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 
-describe( 'BoldEngine', () => {
+describe( 'BoldEditing', () => {
 	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, BoldEngine ]
+				plugins: [ Paragraph, BoldEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -31,7 +32,7 @@ describe( 'BoldEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( BoldEngine ) ).to.be.instanceOf( BoldEngine );
+		expect( editor.plugins.get( BoldEditing ) ).to.be.instanceOf( BoldEditing );
 	} );
 
 	it( 'should set proper schema rules', () => {
@@ -39,6 +40,22 @@ describe( 'BoldEngine', () => {
 		expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'bold' ) ).to.be.true;
 	} );
 
+	it( 'should set editor keystroke', () => {
+		const spy = sinon.spy( editor, 'execute' );
+		const keyEventData = {
+			keyCode: keyCodes.b,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		};
+
+		const wasHandled = editor.keystrokes.press( keyEventData );
+
+		expect( wasHandled ).to.be.true;
+		expect( spy.calledOnce ).to.be.true;
+		expect( keyEventData.preventDefault.calledOnce ).to.be.true;
+	} );
+
 	describe( 'command', () => {
 		it( 'should register bold command', () => {
 			const command = editor.commands.get( 'bold' );

+ 73 - 0
packages/ckeditor5-basic-styles/tests/bold/boldui.js

@@ -0,0 +1,73 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals document */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import BoldEditing from '../../src/bold/boldediting';
+import BoldUI from '../../src/bold/boldui';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+testUtils.createSinonSandbox();
+
+describe( 'BoldUI', () => {
+	let editor, boldView;
+
+	beforeEach( () => {
+		const editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Paragraph, BoldEditing, BoldUI ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				boldView = editor.ui.componentFactory.create( 'bold' );
+			} );
+	} );
+
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
+	it( 'should register bold feature component', () => {
+		expect( boldView ).to.be.instanceOf( ButtonView );
+		expect( boldView.isOn ).to.be.false;
+		expect( boldView.label ).to.equal( 'Bold' );
+		expect( boldView.icon ).to.match( /<svg / );
+		expect( boldView.keystroke ).to.equal( 'CTRL+B' );
+	} );
+
+	it( 'should execute bold command on model execute event', () => {
+		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
+
+		boldView.fire( 'execute' );
+
+		sinon.assert.calledOnce( executeSpy );
+		sinon.assert.calledWithExactly( executeSpy, 'bold' );
+	} );
+
+	it( 'should bind model to bold command', () => {
+		const command = editor.commands.get( 'bold' );
+
+		expect( boldView.isOn ).to.be.false;
+		expect( boldView.isEnabled ).to.be.true;
+
+		command.value = true;
+		expect( boldView.isOn ).to.be.true;
+
+		command.isEnabled = false;
+		expect( boldView.isEnabled ).to.be.false;
+	} );
+
+	it( 'should set keystroke in the model', () => {
+		expect( boldView.keystroke ).to.equal( 'CTRL+B' );
+	} );
+} );

+ 6 - 64
packages/ckeditor5-basic-styles/tests/code.js

@@ -3,74 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Code from '../src/code';
-import CodeEngine from '../src/codeengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-
-testUtils.createSinonSandbox();
+import CodeEditing from '../src/code/codeediting';
+import CodeUI from '../src/code/codeui';
 
 describe( 'Code', () => {
-	let editor, codeView;
-
-	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
-		document.body.appendChild( editorElement );
-
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, Code ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-
-				codeView = editor.ui.componentFactory.create( 'code' );
-			} );
+	it( 'should require CodeEditing and CodeUI', () => {
+		expect( Code.requires ).to.deep.equal( [ CodeEditing, CodeUI ] );
 	} );
 
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Code ) ).to.be.instanceOf( Code );
-	} );
-
-	it( 'should load CodeEngine', () => {
-		expect( editor.plugins.get( CodeEngine ) ).to.be.instanceOf( CodeEngine );
-	} );
-
-	it( 'should register code feature component', () => {
-		expect( codeView ).to.be.instanceOf( ButtonView );
-		expect( codeView.isOn ).to.be.false;
-		expect( codeView.label ).to.equal( 'Code' );
-		expect( codeView.icon ).to.match( /<svg / );
-	} );
-
-	it( 'should execute code command on model execute event', () => {
-		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-
-		codeView.fire( 'execute' );
-
-		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'code' );
-	} );
-
-	it( 'should bind model to code command', () => {
-		const command = editor.commands.get( 'code' );
-
-		expect( codeView.isOn ).to.be.false;
-		expect( codeView.isEnabled ).to.be.true;
-
-		command.value = true;
-		expect( codeView.isOn ).to.be.true;
-
-		command.isEnabled = false;
-		expect( codeView.isEnabled ).to.be.false;
+	it( 'should be named', () => {
+		expect( Code.pluginName ).to.equal( 'Code' );
 	} );
 } );

+ 5 - 5
packages/ckeditor5-basic-styles/tests/codeengine.js

@@ -3,22 +3,22 @@
  * For licensing, see LICENSE.md.
  */
 
-import CodeEngine from '../src/codeengine';
+import CodeEditing from '../../src/code/codeediting';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import AttributeCommand from '../src/attributecommand';
+import AttributeCommand from '../../src/attributecommand';
 
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-describe( 'CodeEngine', () => {
+describe( 'CodeEditing', () => {
 	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, CodeEngine ]
+				plugins: [ Paragraph, CodeEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -31,7 +31,7 @@ describe( 'CodeEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( CodeEngine ) ).to.be.instanceOf( CodeEngine );
+		expect( editor.plugins.get( CodeEditing ) ).to.be.instanceOf( CodeEditing );
 	} );
 
 	it( 'should set proper schema rules', () => {

+ 68 - 0
packages/ckeditor5-basic-styles/tests/code/codeui.js

@@ -0,0 +1,68 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals document */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import CodeEditing from '../../src/code/codeediting';
+import CodeUI from '../../src/code/codeui';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+testUtils.createSinonSandbox();
+
+describe( 'CodeUI', () => {
+	let editor, codeView;
+
+	beforeEach( () => {
+		const editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Paragraph, CodeEditing, CodeUI ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				codeView = editor.ui.componentFactory.create( 'code' );
+			} );
+	} );
+
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
+	it( 'should register code feature component', () => {
+		expect( codeView ).to.be.instanceOf( ButtonView );
+		expect( codeView.isOn ).to.be.false;
+		expect( codeView.label ).to.equal( 'Code' );
+		expect( codeView.icon ).to.match( /<svg / );
+	} );
+
+	it( 'should execute code command on model execute event', () => {
+		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
+
+		codeView.fire( 'execute' );
+
+		sinon.assert.calledOnce( executeSpy );
+		sinon.assert.calledWithExactly( executeSpy, 'code' );
+	} );
+
+	it( 'should bind model to code command', () => {
+		const command = editor.commands.get( 'code' );
+
+		expect( codeView.isOn ).to.be.false;
+		expect( codeView.isEnabled ).to.be.true;
+
+		command.value = true;
+		expect( codeView.isOn ).to.be.true;
+
+		command.isEnabled = false;
+		expect( codeView.isEnabled ).to.be.false;
+	} );
+} );

+ 6 - 84
packages/ckeditor5-basic-styles/tests/italic.js

@@ -3,94 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Italic from '../src/italic';
-import ItalicEngine from '../src/italicengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
-
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-
-testUtils.createSinonSandbox();
+import ItalicEditing from '../src/italic/italicediting';
+import ItalicUI from '../src/italic/italicui';
 
 describe( 'Italic', () => {
-	let editor, italicView;
-
-	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
-		document.body.appendChild( editorElement );
-
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, Italic ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-
-				italicView = editor.ui.componentFactory.create( 'italic' );
-			} );
-	} );
-
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Italic ) ).to.be.instanceOf( Italic );
-	} );
-
-	it( 'should load ItalicEngine', () => {
-		expect( editor.plugins.get( ItalicEngine ) ).to.be.instanceOf( ItalicEngine );
-	} );
-
-	it( 'should register italic feature component', () => {
-		expect( italicView ).to.be.instanceOf( ButtonView );
-		expect( italicView.isOn ).to.be.false;
-		expect( italicView.label ).to.equal( 'Italic' );
-		expect( italicView.icon ).to.match( /<svg / );
-		expect( italicView.keystroke ).to.equal( 'CTRL+I' );
+	it( 'should require ItalicEditing and ItalicUI', () => {
+		expect( Italic.requires ).to.deep.equal( [ ItalicEditing, ItalicUI ] );
 	} );
 
-	it( 'should execute italic command on model execute event', () => {
-		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-
-		italicView.fire( 'execute' );
-
-		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'italic' );
-	} );
-
-	it( 'should bind model to italic command', () => {
-		const command = editor.commands.get( 'italic' );
-
-		expect( italicView.isOn ).to.be.false;
-		expect( italicView.isEnabled ).to.be.true;
-
-		command.value = true;
-		expect( italicView.isOn ).to.be.true;
-
-		command.isEnabled = false;
-		expect( italicView.isEnabled ).to.be.false;
-	} );
-
-	it( 'should set keystroke in the model', () => {
-		expect( italicView.keystroke ).to.equal( 'CTRL+I' );
-	} );
-
-	it( 'should set editor keystroke', () => {
-		const spy = sinon.spy( editor, 'execute' );
-
-		const wasHandled = editor.keystrokes.press( {
-			keyCode: keyCodes.i,
-			ctrlKey: true,
-			preventDefault: sinon.spy(),
-			stopPropagation: sinon.spy()
-		} );
-
-		expect( wasHandled ).to.be.true;
-		expect( spy.calledOnce ).to.be.true;
+	it( 'should be named', () => {
+		expect( Italic.pluginName ).to.equal( 'Italic' );
 	} );
 } );

+ 5 - 5
packages/ckeditor5-basic-styles/tests/italicengine.js

@@ -3,22 +3,22 @@
  * For licensing, see LICENSE.md.
  */
 
-import ItalicEngine from '../src/italicengine';
+import ItalicEditing from '../../src/italic/italicediting';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import AttributeCommand from '../src/attributecommand';
+import AttributeCommand from '../../src/attributecommand';
 
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-describe( 'ItalicEngine', () => {
+describe( 'ItalicEditing', () => {
 	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, ItalicEngine ]
+				plugins: [ Paragraph, ItalicEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -31,7 +31,7 @@ describe( 'ItalicEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( ItalicEngine ) ).to.be.instanceOf( ItalicEngine );
+		expect( editor.plugins.get( ItalicEditing ) ).to.be.instanceOf( ItalicEditing );
 	} );
 
 	it( 'should set proper schema rules', () => {

+ 88 - 0
packages/ckeditor5-basic-styles/tests/italic/italicui.js

@@ -0,0 +1,88 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals document */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import ItalicEditing from '../../src/italic/italicediting';
+import ItalicUI from '../../src/italic/italicui';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+testUtils.createSinonSandbox();
+
+describe( 'ItalicUI', () => {
+	let editor, italicView;
+
+	beforeEach( () => {
+		const editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Paragraph, ItalicEditing, ItalicUI ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				italicView = editor.ui.componentFactory.create( 'italic' );
+			} );
+	} );
+
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
+	it( 'should register italic feature component', () => {
+		expect( italicView ).to.be.instanceOf( ButtonView );
+		expect( italicView.isOn ).to.be.false;
+		expect( italicView.label ).to.equal( 'Italic' );
+		expect( italicView.icon ).to.match( /<svg / );
+		expect( italicView.keystroke ).to.equal( 'CTRL+I' );
+	} );
+
+	it( 'should execute italic command on model execute event', () => {
+		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
+
+		italicView.fire( 'execute' );
+
+		sinon.assert.calledOnce( executeSpy );
+		sinon.assert.calledWithExactly( executeSpy, 'italic' );
+	} );
+
+	it( 'should bind model to italic command', () => {
+		const command = editor.commands.get( 'italic' );
+
+		expect( italicView.isOn ).to.be.false;
+		expect( italicView.isEnabled ).to.be.true;
+
+		command.value = true;
+		expect( italicView.isOn ).to.be.true;
+
+		command.isEnabled = false;
+		expect( italicView.isEnabled ).to.be.false;
+	} );
+
+	it( 'should set keystroke in the model', () => {
+		expect( italicView.keystroke ).to.equal( 'CTRL+I' );
+	} );
+
+	it( 'should set editor keystroke', () => {
+		const spy = sinon.spy( editor, 'execute' );
+
+		const wasHandled = editor.keystrokes.press( {
+			keyCode: keyCodes.i,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		} );
+
+		expect( wasHandled ).to.be.true;
+		expect( spy.calledOnce ).to.be.true;
+	} );
+} );

+ 6 - 87
packages/ckeditor5-basic-styles/tests/strikethrough.js

@@ -3,97 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Strikethrough from '../src/strikethrough';
-import StrikethroughEngine from '../src/strikethroughengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
-
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-
-testUtils.createSinonSandbox();
+import StrikethroughEditing from '../src/strikethrough/strikethroughediting';
+import StrikethroughUI from '../src/strikethrough/strikethroughui';
 
 describe( 'Strikethrough', () => {
-	let editor, strikeView;
-
-	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
-		document.body.appendChild( editorElement );
-
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, Strikethrough ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-
-				strikeView = editor.ui.componentFactory.create( 'strikethrough' );
-			} );
-	} );
-
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Strikethrough ) ).to.be.instanceOf( Strikethrough );
-	} );
-
-	it( 'should load StrikethroughEngine', () => {
-		expect( editor.plugins.get( StrikethroughEngine ) ).to.be.instanceOf( StrikethroughEngine );
-	} );
-
-	it( 'should register strikethrough feature component', () => {
-		expect( strikeView ).to.be.instanceOf( ButtonView );
-		expect( strikeView.isOn ).to.be.false;
-		expect( strikeView.label ).to.equal( 'Strikethrough' );
-		expect( strikeView.icon ).to.match( /<svg / );
-		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
+	it( 'should require StrikethroughEditing and StrikethroughUI', () => {
+		expect( Strikethrough.requires ).to.deep.equal( [ StrikethroughEditing, StrikethroughUI ] );
 	} );
 
-	it( 'should execute strikethrough command on model execute event', () => {
-		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-
-		strikeView.fire( 'execute' );
-
-		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'strikethrough' );
-	} );
-
-	it( 'should bind model to strikethrough command', () => {
-		const command = editor.commands.get( 'strikethrough' );
-
-		expect( strikeView.isOn ).to.be.false;
-		expect( strikeView.isEnabled ).to.be.true;
-
-		command.value = true;
-		expect( strikeView.isOn ).to.be.true;
-
-		command.isEnabled = false;
-		expect( strikeView.isEnabled ).to.be.false;
-	} );
-
-	it( 'should set keystroke in the model', () => {
-		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
-	} );
-
-	it( 'should set editor keystroke', () => {
-		const spy = sinon.spy( editor, 'execute' );
-		const keyEventData = {
-			keyCode: keyCodes.x,
-			shiftKey: true,
-			ctrlKey: true,
-			preventDefault: sinon.spy(),
-			stopPropagation: sinon.spy()
-		};
-
-		const wasHandled = editor.keystrokes.press( keyEventData );
-
-		expect( wasHandled ).to.be.true;
-		expect( spy.calledOnce ).to.be.true;
-		expect( keyEventData.preventDefault.calledOnce ).to.be.true;
+	it( 'should be named', () => {
+		expect( Strikethrough.pluginName ).to.equal( 'Strikethrough' );
 	} );
 } );

+ 5 - 5
packages/ckeditor5-basic-styles/tests/strikethroughengine.js

@@ -3,22 +3,22 @@
  * For licensing, see LICENSE.md.
  */
 
-import StrikethroughEngine from '../src/strikethroughengine';
+import StrikethroughEditing from '../../src/strikethrough/strikethroughediting';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import AttributeCommand from '../src/attributecommand';
+import AttributeCommand from '../../src/attributecommand';
 
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-describe( 'StrikethroughEngine', () => {
+describe( 'StrikethroughEditing', () => {
 	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, StrikethroughEngine ]
+				plugins: [ Paragraph, StrikethroughEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -31,7 +31,7 @@ describe( 'StrikethroughEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( StrikethroughEngine ) ).to.be.instanceOf( StrikethroughEngine );
+		expect( editor.plugins.get( StrikethroughEditing ) ).to.be.instanceOf( StrikethroughEditing );
 	} );
 
 	it( 'should set proper schema rules', () => {

+ 91 - 0
packages/ckeditor5-basic-styles/tests/strikethrough/strikethroughui.js

@@ -0,0 +1,91 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals document */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import StrikethroughEditing from '../../src/strikethrough/strikethroughediting';
+import StrikethroughUI from '../../src/strikethrough/strikethroughui';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+testUtils.createSinonSandbox();
+
+describe( 'StrikethroughUI', () => {
+	let editor, strikeView;
+
+	beforeEach( () => {
+		const editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Paragraph, StrikethroughEditing, StrikethroughUI ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				strikeView = editor.ui.componentFactory.create( 'strikethrough' );
+			} );
+	} );
+
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
+	it( 'should register strikethrough feature component', () => {
+		expect( strikeView ).to.be.instanceOf( ButtonView );
+		expect( strikeView.isOn ).to.be.false;
+		expect( strikeView.label ).to.equal( 'Strikethrough' );
+		expect( strikeView.icon ).to.match( /<svg / );
+		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
+	} );
+
+	it( 'should execute strikethrough command on model execute event', () => {
+		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
+
+		strikeView.fire( 'execute' );
+
+		sinon.assert.calledOnce( executeSpy );
+		sinon.assert.calledWithExactly( executeSpy, 'strikethrough' );
+	} );
+
+	it( 'should bind model to strikethrough command', () => {
+		const command = editor.commands.get( 'strikethrough' );
+
+		expect( strikeView.isOn ).to.be.false;
+		expect( strikeView.isEnabled ).to.be.true;
+
+		command.value = true;
+		expect( strikeView.isOn ).to.be.true;
+
+		command.isEnabled = false;
+		expect( strikeView.isEnabled ).to.be.false;
+	} );
+
+	it( 'should set keystroke in the model', () => {
+		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
+	} );
+
+	it( 'should set editor keystroke', () => {
+		const spy = sinon.spy( editor, 'execute' );
+		const keyEventData = {
+			keyCode: keyCodes.x,
+			shiftKey: true,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		};
+
+		const wasHandled = editor.keystrokes.press( keyEventData );
+
+		expect( wasHandled ).to.be.true;
+		expect( spy.calledOnce ).to.be.true;
+		expect( keyEventData.preventDefault.calledOnce ).to.be.true;
+	} );
+} );

+ 6 - 84
packages/ckeditor5-basic-styles/tests/underline.js

@@ -3,94 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Underline from '../src/underline';
-import UnderlineEngine from '../src/underlineengine';
-import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
-
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-
-testUtils.createSinonSandbox();
+import UnderlineEditing from '../src/underline/underlineediting';
+import UnderlineUI from '../src/underline/underlineui';
 
 describe( 'Underline', () => {
-	let editor, underlineView;
-
-	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
-		document.body.appendChild( editorElement );
-
-		return ClassicTestEditor
-			.create( editorElement, {
-				plugins: [ Paragraph, Underline ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-
-				underlineView = editor.ui.componentFactory.create( 'underline' );
-			} );
-	} );
-
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Underline ) ).to.be.instanceOf( Underline );
-	} );
-
-	it( 'should load UnderlineEngine', () => {
-		expect( editor.plugins.get( UnderlineEngine ) ).to.be.instanceOf( UnderlineEngine );
-	} );
-
-	it( 'should register underline feature component', () => {
-		expect( underlineView ).to.be.instanceOf( ButtonView );
-		expect( underlineView.isOn ).to.be.false;
-		expect( underlineView.label ).to.equal( 'Underline' );
-		expect( underlineView.icon ).to.match( /<svg / );
-		expect( underlineView.keystroke ).to.equal( 'CTRL+U' );
+	it( 'should require UnderlineEditing and UnderlineUI', () => {
+		expect( Underline.requires ).to.deep.equal( [ UnderlineEditing, UnderlineUI ] );
 	} );
 
-	it( 'should execute underline command on model execute event', () => {
-		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-
-		underlineView.fire( 'execute' );
-
-		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'underline' );
-	} );
-
-	it( 'should bind model to underline command', () => {
-		const command = editor.commands.get( 'underline' );
-
-		expect( underlineView.isOn ).to.be.false;
-		expect( underlineView.isEnabled ).to.be.true;
-
-		command.value = true;
-		expect( underlineView.isOn ).to.be.true;
-
-		command.isEnabled = false;
-		expect( underlineView.isEnabled ).to.be.false;
-	} );
-
-	it( 'should set keystroke in the model', () => {
-		expect( underlineView.keystroke ).to.equal( 'CTRL+U' );
-	} );
-
-	it( 'should set editor keystroke', () => {
-		const spy = sinon.spy( editor, 'execute' );
-
-		const wasHandled = editor.keystrokes.press( {
-			keyCode: keyCodes.u,
-			ctrlKey: true,
-			preventDefault: sinon.spy(),
-			stopPropagation: sinon.spy()
-		} );
-
-		expect( wasHandled ).to.be.true;
-		expect( spy.calledOnce ).to.be.true;
+	it( 'should be named', () => {
+		expect( Underline.pluginName ).to.equal( 'Underline' );
 	} );
 } );

+ 5 - 5
packages/ckeditor5-basic-styles/tests/underlineengine.js

@@ -3,22 +3,22 @@
  * For licensing, see LICENSE.md.
  */
 
-import UnderlineEngine from '../src/underlineengine';
+import UnderlineEditing from '../../src/underline/underlineediting';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import AttributeCommand from '../src/attributecommand';
+import AttributeCommand from '../../src/attributecommand';
 
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-describe( 'UnderlineEngine', () => {
+describe( 'UnderlineEditing', () => {
 	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, UnderlineEngine ]
+				plugins: [ Paragraph, UnderlineEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -31,7 +31,7 @@ describe( 'UnderlineEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( UnderlineEngine ) ).to.be.instanceOf( UnderlineEngine );
+		expect( editor.plugins.get( UnderlineEditing ) ).to.be.instanceOf( UnderlineEditing );
 	} );
 
 	it( 'should set proper schema rules', () => {

+ 88 - 0
packages/ckeditor5-basic-styles/tests/underline/underlineui.js

@@ -0,0 +1,88 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals document */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import UnderlineEditing from '../../src/underline/underlineediting';
+import UnderlineUI from '../../src/underline/underlineui';
+import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+testUtils.createSinonSandbox();
+
+describe( 'Underline', () => {
+	let editor, underlineView;
+
+	beforeEach( () => {
+		const editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Paragraph, UnderlineEditing, UnderlineUI ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				underlineView = editor.ui.componentFactory.create( 'underline' );
+			} );
+	} );
+
+	afterEach( () => {
+		return editor.destroy();
+	} );
+
+	it( 'should register underline feature component', () => {
+		expect( underlineView ).to.be.instanceOf( ButtonView );
+		expect( underlineView.isOn ).to.be.false;
+		expect( underlineView.label ).to.equal( 'Underline' );
+		expect( underlineView.icon ).to.match( /<svg / );
+		expect( underlineView.keystroke ).to.equal( 'CTRL+U' );
+	} );
+
+	it( 'should execute underline command on model execute event', () => {
+		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
+
+		underlineView.fire( 'execute' );
+
+		sinon.assert.calledOnce( executeSpy );
+		sinon.assert.calledWithExactly( executeSpy, 'underline' );
+	} );
+
+	it( 'should bind model to underline command', () => {
+		const command = editor.commands.get( 'underline' );
+
+		expect( underlineView.isOn ).to.be.false;
+		expect( underlineView.isEnabled ).to.be.true;
+
+		command.value = true;
+		expect( underlineView.isOn ).to.be.true;
+
+		command.isEnabled = false;
+		expect( underlineView.isEnabled ).to.be.false;
+	} );
+
+	it( 'should set keystroke in the model', () => {
+		expect( underlineView.keystroke ).to.equal( 'CTRL+U' );
+	} );
+
+	it( 'should set editor keystroke', () => {
+		const spy = sinon.spy( editor, 'execute' );
+
+		const wasHandled = editor.keystrokes.press( {
+			keyCode: keyCodes.u,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		} );
+
+		expect( wasHandled ).to.be.true;
+		expect( spy.calledOnce ).to.be.true;
+	} );
+} );