Browse Source

Passed toolbarClassName attribute to the button dropdown model in the AlignmentUI class.

Aleksander Nowodzinski 8 years ago
parent
commit
a9ca29f537

+ 9 - 3
packages/ckeditor5-alignment/src/alignmentui.js

@@ -87,16 +87,22 @@ export default class AlignmentUI extends Plugin {
 			.forEach( style => this._addButton( style ) );
 
 		componentFactory.add( 'alignmentDropdown', locale => {
-			const buttons = styles.map( style => componentFactory.create( AlignmentEditing.commandName( style ) ) );
+			const buttons = styles.map( style => {
+				return componentFactory.create( AlignmentEditing.commandName( style ) );
+			} );
 
 			const model = new Model( {
 				label: t( 'Text alignment' ),
 				defaultIcon: alignLeftIcon,
 				withText: false,
-				isVertical: true
+				isVertical: true,
+				toolbarClassName: 'ck-editor-toolbar',
+				buttons
 			} );
 
-			return createButtonDropdown( model, buttons, locale );
+			const dropdown = createButtonDropdown( model, locale );
+
+			return dropdown;
 		} );
 	}
 

+ 6 - 5
packages/ckeditor5-alignment/tests/alignmentui.js

@@ -221,14 +221,15 @@ describe( 'Alignment', () => {
 			expect( button ).to.have.property( 'withText', false );
 		} );
 
-		it( 'buttonGroup has the base properties', () => {
-			const buttonGroup = dropdown.buttonGroupView;
+		it( '#toolbarView has the base properties', () => {
+			const toolbarView = dropdown.toolbarView;
 
-			expect( buttonGroup ).to.have.property( 'isVertical', true );
+			expect( toolbarView ).to.have.property( 'className', 'ck-editor-toolbar' );
+			expect( toolbarView ).to.have.property( 'isVertical', true );
 		} );
 
 		it( 'should hold defined buttons', () => {
-			const items = [ ...dropdown.buttonGroupView.items ].map( item => item.label );
+			const items = [ ...dropdown.toolbarView.items ].map( item => item.label );
 
 			expect( items ).to.have.length( 4 );
 
@@ -258,7 +259,7 @@ describe( 'Alignment', () => {
 			} );
 
 			it( 'should hold only defined buttons', () => {
-				const items = [ ...dropdown.buttonGroupView.items ].map( item => item.label );
+				const items = [ ...dropdown.toolbarView.items ].map( item => item.label );
 
 				expect( items ).to.have.length( 2 );