This repository was archived by the owner on Jun 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,15 @@ export default class ToolbarView extends View {
9494 */
9595 this . set ( 'class' ) ;
9696
97+ /**
98+ * When set true, makes the toolbar look compact with {@link #element}.
99+ *
100+ * @observable
101+ * @default false
102+ * @member {String} #isCompact
103+ */
104+ this . set ( 'isCompact' , false ) ;
105+
97106 /**
98107 * A (child) view containing {@link #items toolbar items}.
99108 *
@@ -168,7 +177,8 @@ export default class ToolbarView extends View {
168177 class : [
169178 'ck' ,
170179 'ck-toolbar' ,
171- bind . to ( 'class' )
180+ bind . to ( 'class' ) ,
181+ bind . if ( 'isCompact' , 'ck-toolbar_compact' ) ,
172182 ] ,
173183 role : 'toolbar' ,
174184 'aria-label' : bind . to ( 'ariaLabel' )
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ describe( 'ToolbarView', () => {
5454 expect ( view . locale ) . to . equal ( locale ) ;
5555 } ) ;
5656
57+ it ( 'should set view#isCompact' , ( ) => {
58+ expect ( view . isCompact ) . to . be . false ;
59+ } ) ;
60+
5761 describe ( '#options' , ( ) => {
5862 it ( 'should be an empty object if none were passed' , ( ) => {
5963 expect ( view . options ) . to . deep . equal ( { } ) ;
@@ -166,6 +170,14 @@ describe( 'ToolbarView', () => {
166170 expect ( view . element . classList . contains ( 'foo' ) ) . to . be . false ;
167171 expect ( view . element . classList . contains ( 'bar' ) ) . to . be . false ;
168172 } ) ;
173+
174+ it ( 'reacts on view#isCompact' , ( ) => {
175+ view . isCompact = false ;
176+ expect ( view . element . classList . contains ( 'ck-toolbar_compact' ) ) . to . be . false ;
177+
178+ view . isCompact = true ;
179+ expect ( view . element . classList . contains ( 'ck-toolbar_compact' ) ) . to . be . true ;
180+ } ) ;
169181 } ) ;
170182 } ) ;
171183
You can’t perform that action at this time.
0 commit comments