8
0
Просмотр исходного кода

Bootstrap mentions base plugin.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
49b77f1605

+ 26 - 0
packages/ckeditor5-mention/src/mention.js

@@ -0,0 +1,26 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module mention/mention
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+
+/**
+ * The mention plugin.
+ *
+ * For a detailed overview, check the {@glink features/mention Mention feature documentation}.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class Mention extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'Mention';
+	}
+}

+ 39 - 0
packages/ckeditor5-mention/tests/mention.js

@@ -0,0 +1,39 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import Mention from '../src/mention';
+import global from '@ckeditor/ckeditor5-utils/src/dom/global';
+
+describe( 'Mention', () => {
+	let editorElement, editor;
+
+	beforeEach( () => {
+		editorElement = global.document.createElement( 'div' );
+		global.document.body.appendChild( editorElement );
+
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Mention ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+			} );
+	} );
+
+	afterEach( () => {
+		editorElement.remove();
+
+		return editor.destroy();
+	} );
+
+	it( 'should be loaded', () => {
+		expect( editor.plugins.get( Mention ) ).to.instanceOf( Mention );
+	} );
+
+	it( 'has proper name', () => {
+		expect( Mention.pluginName ).to.equal( 'Mention' );
+	} );
+} );