|
|
@@ -3,6 +3,7 @@
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
|
|
|
|
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
|
|
import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
|
|
|
import ImageToolbar from '../src/imagetoolbar';
|
|
|
import ImageStyle from '../src/imagestyle';
|
|
|
@@ -86,6 +87,28 @@ describe( 'ImageStyle', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
+ it( 'should add separator before the button if toolbar is present and already has items', () => {
|
|
|
+ const editorElement = global.document.createElement( 'div' );
|
|
|
+ global.document.body.appendChild( editorElement );
|
|
|
+
|
|
|
+ const FooPlugin = class extends Plugin {
|
|
|
+ init() {
|
|
|
+ this.editor.ui.componentFactory.add( 'foo', () => new ButtonView() );
|
|
|
+
|
|
|
+ this.editor.config.get( 'image.defaultToolbar' ).push( 'foo' );
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return ClassicTestEditor.create( editorElement, {
|
|
|
+ plugins: [ FooPlugin, ImageStyle, ImageToolbar ]
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ expect( newEditor.config.get( 'image.defaultToolbar' ) ).to.eql( [ 'foo', '|', 'imageStyleFull', 'imageStyleSide' ] );
|
|
|
+
|
|
|
+ newEditor.destroy();
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'should not add buttons to image toolbar if configuration is present', () => {
|
|
|
const editorElement = global.document.createElement( 'div' );
|
|
|
global.document.body.appendChild( editorElement );
|