Skip to content

Commit a68da02

Browse files
committed
Controlgroup: fixup
1 parent 92580c3 commit a68da02

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

tests/unit/controlgroup/controlgroup.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,27 @@
5656
<option>Slow</option>
5757
</select>
5858
</div>
59+
<div class="controlgroup-custom-selector">
60+
<button style="display:none">Button with icon only</button>
61+
<select>
62+
<option>Fast</option>
63+
<option>Medium</option>
64+
<option>Slow</option>
65+
</select>
66+
<label for="checkbox">Checkbox</label>
67+
<input type="checkbox" value="checkbox" id="checkbox" />
68+
<select>
69+
<option>Fast</option>
70+
<option>Medium</option>
71+
<option>Slow</option>
72+
</select>
73+
<a href="#" class="button">Button with icon on the bottom</a>
74+
<select>
75+
<option>Fast</option>
76+
<option>Medium</option>
77+
<option>Slow</option>
78+
</select>
79+
</div>
5980
</div>
6081
</body>
6182
</html>

tests/unit/controlgroup/controlgroup_options.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,35 @@ test( "items", function() {
5252
expect( 2 );
5353
});
5454

55+
test( "items: custom selector", function() {
56+
var element = $( ".controlgroup-custom-selector" ).controlgroup({
57+
items: {
58+
"button": ".button"
59+
}
60+
});
61+
62+
strictEqual( element.children( ".ui-button" ).length, 5,
63+
"Correct child widgets are called when custom selector used" );
64+
expect( 2 );
65+
});
66+
67+
$.widget( "ui.test", {
68+
_create: function (){
69+
this.element.addClass( "ui-test" );
70+
}
71+
});
72+
test( "items: custom widget", function() {
73+
var element = $( ".controlgroup-custom-widget" ).controlgroup({
74+
items: {
75+
"test": ".test"
76+
}
77+
});
78+
79+
strictEqual( element.children( ".ui-button" ).length, 5,
80+
"Correct child widgets are called when custom selector used" );
81+
expect( 2 );
82+
});
83+
5584
test( "excludeInvisible", function() {
5685
var element = $( ".controlgroup" ).controlgroup(),
5786
buttons = element.children( ".ui-button" );

0 commit comments

Comments
 (0)