Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge 46f8d07 into 6acb49e
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Sep 16, 2019
2 parents 6acb49e + 46f8d07 commit 8da2f0c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/classiceditorui.js
Expand Up @@ -148,6 +148,7 @@ export default class ClassicEditorUI extends EditorUI {
view.stickyPanel.viewportTopOffset = this._toolbarConfig.viewportTopOffset;
}

view.toolbar.shouldGroupWhenFull = true;
view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );

enableToolbarKeyboardFocus( {
Expand Down
60 changes: 33 additions & 27 deletions tests/classiceditorui.js
Expand Up @@ -164,38 +164,44 @@ describe( 'ClassicEditorUI', () => {
} );
} );

describe( 'view.toolbar#items', () => {
it( 'are filled with the config.toolbar (specified as an Array)', () => {
return VirtualClassicTestEditor
.create( '', {
toolbar: [ 'foo', 'bar' ]
} )
.then( editor => {
const items = editor.ui.view.toolbar.items;
describe( 'view.toolbar', () => {
it( 'has automatic items grouping enabled', () => {
expect( view.toolbar.shouldGroupWhenFull ).to.be.true;
} );

expect( items.get( 0 ).name ).to.equal( 'foo' );
expect( items.get( 1 ).name ).to.equal( 'bar' );
describe( '#items', () => {
it( 'are filled with the config.toolbar (specified as an Array)', () => {
return VirtualClassicTestEditor
.create( '', {
toolbar: [ 'foo', 'bar' ]
} )
.then( editor => {
const items = editor.ui.view.toolbar.items;

return editor.destroy();
} );
} );
expect( items.get( 0 ).name ).to.equal( 'foo' );
expect( items.get( 1 ).name ).to.equal( 'bar' );

it( 'are filled with the config.toolbar (specified as an Object)', () => {
return VirtualClassicTestEditor
.create( '', {
toolbar: {
items: [ 'foo', 'bar' ],
viewportTopOffset: 100
}
} )
.then( editor => {
const items = editor.ui.view.toolbar.items;
return editor.destroy();
} );
} );

expect( items.get( 0 ).name ).to.equal( 'foo' );
expect( items.get( 1 ).name ).to.equal( 'bar' );
it( 'are filled with the config.toolbar (specified as an Object)', () => {
return VirtualClassicTestEditor
.create( '', {
toolbar: {
items: [ 'foo', 'bar' ],
viewportTopOffset: 100
}
} )
.then( editor => {
const items = editor.ui.view.toolbar.items;

return editor.destroy();
} );
expect( items.get( 0 ).name ).to.equal( 'foo' );
expect( items.get( 1 ).name ).to.equal( 'bar' );

return editor.destroy();
} );
} );
} );
} );

Expand Down

0 comments on commit 8da2f0c

Please sign in to comment.