|
|
@@ -10,19 +10,17 @@
|
|
|
import Editor from '/ckeditor5/editor/editor.js';
|
|
|
import Model from '/ckeditor5/ui/model.js';
|
|
|
import View from '/ckeditor5/ui/view.js';
|
|
|
-import Controller from '/ckeditor5/ui/controller.js';
|
|
|
import Toolbar from '/ckeditor5/ui/bindings/toolbar.js';
|
|
|
|
|
|
describe( 'Toolbar', () => {
|
|
|
- let toolbar, view, model, editor;
|
|
|
+ let toolbar, model, editor;
|
|
|
|
|
|
beforeEach( () => {
|
|
|
editor = new Editor();
|
|
|
model = new Model( {
|
|
|
isActive: false
|
|
|
} );
|
|
|
- view = new View( model );
|
|
|
- toolbar = new Toolbar( model, view, editor );
|
|
|
+ toolbar = new Toolbar( model, new View(), editor );
|
|
|
} );
|
|
|
|
|
|
describe( 'constructor', () => {
|
|
|
@@ -30,37 +28,4 @@ describe( 'Toolbar', () => {
|
|
|
expect( toolbar ).to.have.property( 'editor', editor );
|
|
|
} );
|
|
|
} );
|
|
|
-
|
|
|
- describe( 'addButtons', () => {
|
|
|
- it( 'creates buttons for each button name', () => {
|
|
|
- const createSpy = sinon.spy( () => new Controller() );
|
|
|
-
|
|
|
- editor.ui = {
|
|
|
- featureComponents: {
|
|
|
- create: createSpy
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- toolbar.addButtons( [ 'foo', 'bar' ] );
|
|
|
-
|
|
|
- expect( createSpy.callCount ).to.equal( 2 );
|
|
|
- expect( createSpy.firstCall.calledWith( 'foo' ) ).to.be.true;
|
|
|
- expect( createSpy.secondCall.calledWith( 'bar' ) ).to.be.true;
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'adds created components to the collection of buttons', () => {
|
|
|
- const component = new Controller();
|
|
|
- const createSpy = sinon.spy( () => component );
|
|
|
-
|
|
|
- editor.ui = {
|
|
|
- featureComponents: {
|
|
|
- create: createSpy
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- toolbar.addButtons( [ 'foo' ] );
|
|
|
-
|
|
|
- expect( toolbar.collections.get( 'buttons' ).get( 0 ) ).to.equal( component );
|
|
|
- } );
|
|
|
- } );
|
|
|
} );
|