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

Commit

Permalink
Merge pull request #188 from ckeditor/t/187
Browse files Browse the repository at this point in the history
Other: Made the image text alternative form buttons thicker with a fill color and no background. Closes #187.
  • Loading branch information
dkonopka authored Mar 15, 2018
2 parents c23792c + cf9193c commit 25c17ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/imagetextalternative/ui/textalternativeformview.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ export default class TextAlternativeFormView extends View {
*
* @member {module:ui/button/buttonview~ButtonView} #saveButtonView
*/
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon );
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon, 'ck-button-save' );
this.saveButtonView.type = 'submit';

/**
* A button used to cancel the form.
*
* @member {module:ui/button/buttonview~ButtonView} #cancelButtonView
*/
this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'cancel' );
this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'ck-button-cancel', 'cancel' );

/**
* A collection of views which can be focused in the form.
Expand Down Expand Up @@ -104,14 +104,6 @@ export default class TextAlternativeFormView extends View {
}
} );

this.saveButtonView.extendTemplate( {
attributes: {
class: [
'ck-button-action'
]
}
} );

this.setTemplate( {
tag: 'form',

Expand Down Expand Up @@ -158,10 +150,11 @@ export default class TextAlternativeFormView extends View {
* @private
* @param {String} label The button label
* @param {String} icon The button's icon.
* @param {String} className The additional button CSS class name.
* @param {String} [eventName] The event name that the ButtonView#execute event will be delegated to.
* @returns {module:ui/button/buttonview~ButtonView} The button view instance.
*/
_createButton( label, icon, eventName ) {
_createButton( label, icon, className, eventName ) {
const button = new ButtonView( this.locale );

button.set( {
Expand All @@ -170,6 +163,12 @@ export default class TextAlternativeFormView extends View {
tooltip: true
} );

button.extendTemplate( {
attributes: {
class: className
}
} );

if ( eventName ) {
button.delegate( 'execute' ).to( this, eventName );
}
Expand Down
5 changes: 5 additions & 0 deletions tests/imagetextalternative/ui/textalternativeformview.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ describe( 'TextAlternativeFormView', () => {
expect( view.labeledInput ).to.be.instanceOf( View );
expect( view.saveButtonView ).to.be.instanceOf( View );
expect( view.cancelButtonView ).to.be.instanceOf( View );

view.render();

expect( view.saveButtonView.element.classList.contains( 'ck-button-save' ) ).to.be.true;
expect( view.cancelButtonView.element.classList.contains( 'ck-button-cancel' ) ).to.be.true;
} );

it( 'should create #_focusCycler instance', () => {
Expand Down

0 comments on commit 25c17ad

Please sign in to comment.