|
@@ -10,6 +10,7 @@ import ToolbarView from '../../../src/toolbar/toolbarview';
|
|
|
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
|
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
|
|
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
|
|
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
|
|
|
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
|
|
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
|
|
|
|
|
+import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
|
|
|
|
|
import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model.js';
|
|
import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model.js';
|
|
@@ -71,6 +72,28 @@ describe( 'ContextualToolbar', () => {
|
|
|
expect( contextualToolbar.toolbarView.items ).to.length( 2 );
|
|
expect( contextualToolbar.toolbarView.items ).to.length( 2 );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ it( 'should accept the extended format of the toolbar config', () => {
|
|
|
|
|
+ const editorElement = document.createElement( 'div' );
|
|
|
|
|
+ document.body.appendChild( editorElement );
|
|
|
|
|
+
|
|
|
|
|
+ return ClassicTestEditor
|
|
|
|
|
+ .create( editorElement, {
|
|
|
|
|
+ plugins: [ Paragraph, Bold, Italic, Underline, ContextualToolbar ],
|
|
|
|
|
+ contextualToolbar: {
|
|
|
|
|
+ items: [ 'bold', 'italic', 'underline' ]
|
|
|
|
|
+ }
|
|
|
|
|
+ } )
|
|
|
|
|
+ .then( editor => {
|
|
|
|
|
+ const contextualToolbar = editor.plugins.get( ContextualToolbar );
|
|
|
|
|
+
|
|
|
|
|
+ expect( contextualToolbar.toolbarView.items ).to.length( 3 );
|
|
|
|
|
+
|
|
|
|
|
+ editorElement.remove();
|
|
|
|
|
+
|
|
|
|
|
+ return editor.destroy();
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
it( 'should fire internal `_selectionChangeDebounced` event 200 ms after last selection change', done => {
|
|
it( 'should fire internal `_selectionChangeDebounced` event 200 ms after last selection change', done => {
|
|
|
// This test uses setTimeout to test lodash#debounce because sinon fake timers
|
|
// This test uses setTimeout to test lodash#debounce because sinon fake timers
|
|
|
// doesn't work with lodash. Lodash keeps time related stuff in a closure
|
|
// doesn't work with lodash. Lodash keeps time related stuff in a closure
|