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

Commit 25c17ad

Browse files
authoredMar 15, 2018
Merge pull request #188 from ckeditor/t/187
Other: Made the image text alternative form buttons thicker with a fill color and no background. Closes #187.
2 parents c23792c + cf9193c commit 25c17ad

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed
 

‎src/imagetextalternative/ui/textalternativeformview.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ export default class TextAlternativeFormView extends View {
6565
*
6666
* @member {module:ui/button/buttonview~ButtonView} #saveButtonView
6767
*/
68-
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon );
68+
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon, 'ck-button-save' );
6969
this.saveButtonView.type = 'submit';
7070

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

7878
/**
7979
* A collection of views which can be focused in the form.
@@ -104,14 +104,6 @@ export default class TextAlternativeFormView extends View {
104104
}
105105
} );
106106

107-
this.saveButtonView.extendTemplate( {
108-
attributes: {
109-
class: [
110-
'ck-button-action'
111-
]
112-
}
113-
} );
114-
115107
this.setTemplate( {
116108
tag: 'form',
117109

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

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

166+
button.extendTemplate( {
167+
attributes: {
168+
class: className
169+
}
170+
} );
171+
173172
if ( eventName ) {
174173
button.delegate( 'execute' ).to( this, eventName );
175174
}

‎tests/imagetextalternative/ui/textalternativeformview.js

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ describe( 'TextAlternativeFormView', () => {
4343
expect( view.labeledInput ).to.be.instanceOf( View );
4444
expect( view.saveButtonView ).to.be.instanceOf( View );
4545
expect( view.cancelButtonView ).to.be.instanceOf( View );
46+
47+
view.render();
48+
49+
expect( view.saveButtonView.element.classList.contains( 'ck-button-save' ) ).to.be.true;
50+
expect( view.cancelButtonView.element.classList.contains( 'ck-button-cancel' ) ).to.be.true;
4651
} );
4752

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

0 commit comments

Comments
 (0)
This repository has been archived.