@@ -160,4 +160,39 @@ QUnit.test( "Single controlgroup button - vertical", function( assert ) {
160
160
" ui-corner-tr ui-corner-tl ui-corner-bl ui corner-br" ) ;
161
161
} ) ;
162
162
163
+ QUnit . module ( "Controlgroup: Non-empty class key" , {
164
+ setup : function ( ) {
165
+ this . classKey = $ . ui . selectmenu . prototype . options . classes [ "ui-selectmenu-button-closed" ] ;
166
+ $ . ui . selectmenu . prototype . options . classes [ "ui-selectmenu-button-closed" ] =
167
+ $ . trim ( $ . ui . selectmenu . prototype . options . classes [ "ui-selectmenu-button-closed" ] +
168
+ " something-custom" ) ;
169
+ } ,
170
+ teardown : function ( ) {
171
+ $ . ui . selectmenu . prototype . options . classes [ "ui-selectmenu-button-closed" ] = this . classKey ;
172
+ }
173
+ } ) ;
174
+
175
+ QUnit . test ( "Controlgroup handles non-empty class key correctly" , function ( assert ) {
176
+ assert . expect ( 2 ) ;
177
+
178
+ $ ( ".controlgroup-non-empty-class-key" )
179
+ . controlgroup ( )
180
+ . controlgroup ( "instance" ) ;
181
+
182
+ assert . deepEqual (
183
+ ( ( ( $ ( "#non-empty-class-key-first" )
184
+ . selectmenu ( "option" , "classes" ) [ "ui-selectmenu-button-closed" ] || "" )
185
+ . match ( / \S + / g ) ) || [ ] ) . sort ( ) ,
186
+ [ "something-custom" , "ui-corner-left" ] ,
187
+ "First controlgroup item has the expected value for the class key" ) ;
188
+
189
+ assert . deepEqual (
190
+ ( ( ( $ ( "#non-empty-class-key-second" )
191
+ . selectmenu ( "option" , "classes" ) [ "ui-selectmenu-button-closed" ] || "" )
192
+ . match ( / \S + / g ) ) || [ ] ) . sort ( ) ,
193
+ [ "something-custom" , "ui-corner-right" ] ,
194
+ "Second controlgroup item has the expected value for the class key" ) ;
195
+
196
+ } ) ;
197
+
163
198
} ) ;
0 commit comments