Browse Source

Added plugin name to the ContextualToolbar plugin.

Oskar Wróbel 8 years ago
parent
commit
2120f1d60a

+ 7 - 0
packages/ckeditor5-ui/src/toolbar/contextualtoolbar.js

@@ -21,6 +21,13 @@ import debounce from '@ckeditor/ckeditor5-utils/src/lib/lodash/debounce';
  * @extends module:core/plugin~Plugin
  */
 export default class ContextualToolbar extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'contextualtoolbar';
+	}
+
 	/**
 	 * @inheritDoc
 	 */

+ 9 - 1
packages/ckeditor5-ui/tests/toolbar/contextualtoolbar.js

@@ -6,6 +6,7 @@ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictest
 import ContextualToolbar from '../../src/toolbar/contextualtoolbar';
 import ContextualBalloon from '../../src/contextualballoon';
 import ToolbarView from '../../src/toolbar/toolbarview';
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
@@ -48,7 +49,8 @@ describe( 'ContextualToolbar', () => {
 		return editor.destroy();
 	} );
 
-	it( 'should be loaded', () => {
+	it( 'should create a plugin instance', () => {
+		expect( contextualToolbar ).to.instanceOf( Plugin );
 		expect( contextualToolbar ).to.instanceOf( ContextualToolbar );
 	} );
 
@@ -285,6 +287,12 @@ describe( 'ContextualToolbar', () => {
 		sinon.assert.notCalled( spy );
 	} );
 
+	describe( 'pluginName', () => {
+		it( 'should return plugin by name', () => {
+			expect( editor.plugins.get( 'contextualballoon' ) ).to.equal( balloon );
+		} );
+	} );
+
 	describe( 'destroy()', () => {
 		it( 'should not fire `_selectionChangeDone` after plugin destroy', ( done ) => {
 			const spy = sandbox.spy();