File tree 3 files changed +26
-6
lines changed
3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 5
5
< title > jQuery UI Controlgroup Test Suite</ title >
6
6
7
7
< script src ="../../../external/requirejs/require.js "> </ script >
8
- < script src ="../../lib/css.js " data-modules ="core button checkboxradio selectmenu controlgroup "> </ script >
8
+ < script src ="../../lib/css.js " data-modules ="core button checkboxradio selectmenu spinner controlgroup "> </ script >
9
9
< script src ="../../lib/bootstrap.js " data-modules ="common core methods options "> </ script >
10
10
</ head >
11
11
< body >
28
28
</ select >
29
29
< div class ="test "> </ div >
30
30
< button > Button with icon on the bottom</ button >
31
+ < label for ="spinner " class ="ui-controlgroup-label "> # of cars</ label >
32
+ < input id ="spinner " class ="ui-spinner-input ">
31
33
< select >
32
34
< option > Fast</ option >
33
35
< option > Medium</ option >
Original file line number Diff line number Diff line change @@ -9,13 +9,11 @@ define( [
9
9
module ( "Controlgroup: Core" ) ;
10
10
11
11
test ( "selectmenu: open/close corners" , function ( assert ) {
12
- expect ( 1 ) ;
12
+ expect ( 12 ) ;
13
13
var element = $ ( ".controlgroup" ) . controlgroup ( ) ,
14
14
selects = element . find ( "select" ) ,
15
15
selectButton = selects . eq ( 0 ) . selectmenu ( "widget" ) ;
16
16
17
- expect ( 12 ) ;
18
-
19
17
selects . eq ( 0 ) . selectmenu ( "open" ) ;
20
18
assert . hasClasses ( selectButton , "ui-corner-tl" ,
21
19
"Horizontal: First selectmenu gets ui-corner-tl when opened" ) ;
@@ -66,4 +64,13 @@ test( "selectmenu: open/close corners", function( assert ) {
66
64
"vertical: Last selectmenu gets ui-corner-bottom when closed" ) ;
67
65
} ) ;
68
66
67
+ test ( "selectmenu: controlgroupLabel" , function ( assert ) {
68
+ expect ( 2 ) ;
69
+ var element = $ ( ".controlgroup" ) . controlgroup ( ) ;
70
+ var label = element . find ( ".ui-controlgroup-label" ) ;
71
+
72
+ assert . hasClasses ( label , "ui-widget ui-widget-content ui-state-default ui-controlgroup-item" ) ;
73
+ assert . hasClasses ( label . find ( "span" ) , "ui-controlgroup-label-contents" ) ;
74
+ } ) ;
75
+
69
76
} ) ;
Original file line number Diff line number Diff line change @@ -61,6 +61,12 @@ return $.widget( "ui.controlgroup", {
61
61
this . _callChildMethod ( "destroy" ) ;
62
62
this . childWidgets . removeData ( "ui-controlgroup-data" ) ;
63
63
this . element . removeAttr ( "role" ) ;
64
+ if ( this . options . items . controlgroupLabel ) {
65
+ this . element
66
+ . find ( this . options . items . controlgroupLabel )
67
+ . find ( ".ui-controlgroup-label-contents" )
68
+ . contents ( ) . unwrap ( ) ;
69
+ }
64
70
} ,
65
71
66
72
_initWidgets : function ( ) {
@@ -72,8 +78,8 @@ return $.widget( "ui.controlgroup", {
72
78
var labels ;
73
79
var options = { } ;
74
80
75
- // Make sure the widget actually exists and has a selector set
76
- if ( ! $ . fn [ widget ] || ! selector ) {
81
+ // Make sure the widget has a selector set
82
+ if ( ! selector ) {
77
83
return ;
78
84
}
79
85
@@ -87,6 +93,11 @@ return $.widget( "ui.controlgroup", {
87
93
return ;
88
94
}
89
95
96
+ // Make sure the widget actually exists
97
+ if ( ! $ . fn [ widget ] ) {
98
+ return ;
99
+ }
100
+
90
101
// We assume everything is in the middle to start because we can't determine
91
102
// first / last elements until all enhancments are done.
92
103
if ( that [ "_" + widget + "Options" ] ) {
You can’t perform that action at this time.
0 commit comments