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 +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,14 @@ export default class DropdownView extends View {
120120 */
121121 this . set ( 'isEnabled' , true ) ;
122122
123+ /**
124+ * (Optional) The additional CSS class set on the dropdown {@link #element}.
125+ *
126+ * @observable
127+ * @member {String} #class
128+ */
129+ this . set ( 'class' ) ;
130+
123131 /**
124132 * Tracks information about DOM focus in the dropdown.
125133 *
@@ -147,6 +155,7 @@ export default class DropdownView extends View {
147155 class : [
148156 'ck' ,
149157 'ck-dropdown' ,
158+ bind . to ( 'class' ) ,
150159 bind . if ( 'isEnabled' , 'ck-disabled' , value => ! value )
151160 ]
152161 } ,
Original file line number Diff line number Diff line change @@ -97,15 +97,20 @@ describe( 'DropdownView', () => {
9797 } ) ;
9898 } ) ;
9999
100- describe ( 'DOM' , ( ) => {
101- describe ( 'view#element .ck-disabled class to view#isEnabled ' , ( ) => {
102- it ( 'is activated ' , ( ) => {
100+ describe ( 'DOM element bindings ' , ( ) => {
101+ describe ( 'class' , ( ) => {
102+ it ( 'reacts on view#isEnabled ' , ( ) => {
103103 view . isEnabled = true ;
104104 expect ( view . element . classList . contains ( 'ck-disabled' ) ) . to . be . false ;
105105
106106 view . isEnabled = false ;
107107 expect ( view . element . classList . contains ( 'ck-disabled' ) ) . to . be . true ;
108108 } ) ;
109+
110+ it ( 'reacts on view#class' , ( ) => {
111+ view . class = 'custom-css-class' ;
112+ expect ( view . element . classList . contains ( 'custom-css-class' ) ) . to . be . true ;
113+ } ) ;
109114 } ) ;
110115 } ) ;
111116 } ) ;
You can’t perform that action at this time.
0 commit comments