Skip to content

Commit e70fb43

Browse files
committed
Button: breakup deprecated tests
1 parent 310852d commit e70fb43

File tree

8 files changed

+132
-126
lines changed

8 files changed

+132
-126
lines changed

demos/controlgroup/default.html

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<<<<<<< HEAD
65
<title>jQuery UI Controlgroup - Default Functionality</title>
7-
=======
8-
<title>jQuery UI Controlgroup - Default Funstionality</title>
9-
>>>>>>> 14168e2... Controlgroup: Inital commit of new widget
106
<link rel="stylesheet" href="../../themes/base/all.css">
117
<script src="../../external/jquery/jquery.js"></script>
128
<script src="../../ui/core.js"></script>
@@ -34,17 +30,13 @@
3430
.ui-controlgroup-vertical select {
3531
width: 100%;
3632
}
37-
<<<<<<< HEAD
3833
.ui-controlgroup.ui-controlgroup-vertical > button.ui-button {
3934
text-align: center;
4035
}
41-
=======
42-
>>>>>>> 14168e2... Controlgroup: Inital commit of new widget
4336
</style>
4437
</head>
4538
<body>
4639
<div class="demo-description">
47-
<<<<<<< HEAD
4840
<p>A Controlgroup featuring various form controls</p>
4941
</div>
5042
<div class="widget">
@@ -93,102 +85,5 @@ <h1>Controlgroup</h1>
9385
</div>
9486
</fieldset>
9587
</div>
96-
97-
=======
98-
<p>Some buttons with various combinations of text and icons.</p>
99-
</div>
100-
<div class="widget">
101-
<h1>Widget</h1>
102-
<div class="controlgroup">
103-
<button style="display:none">Button with icon only</button>
104-
<select>
105-
<option>Fast</option>
106-
<option>Medium</option>
107-
<option>Slow</option>
108-
</select>
109-
<label for="checkbox">Checkbox</label>
110-
<input type="checkbox" value="checkbox" id="checkbox" />
111-
<select>
112-
<option>Fast</option>
113-
<option>Medium</option>
114-
<option>Slow</option>
115-
</select>
116-
<button>Button with icon on the bottom</button>
117-
<select>
118-
<option>Fast</option>
119-
<option>Medium</option>
120-
<option>Slow</option>
121-
</select>
122-
</div>
123-
<br/>
124-
<div class="controlgroup">
125-
<button style="display:none">Button with icon only</button>
126-
<select>
127-
<option>Fast</option>
128-
<option>Medium</option>
129-
<option>Slow</option>
130-
</select>
131-
<label for="checkbox2">Checkbox</label>
132-
<input type="checkbox" value="checkbox2" id="checkbox2" />
133-
<select>
134-
<option>Fast</option>
135-
<option>Medium</option>
136-
<option>Slow</option>
137-
</select>
138-
<button>Button with icon on the bottom</button>
139-
<select>
140-
<option>Fast</option>
141-
<option>Medium</option>
142-
<option>Slow</option>
143-
</select>
144-
</div>
145-
</div>
146-
<div class="css">
147-
<h1>CSS</h1>
148-
<div class="ui-controlgroup">
149-
<button class="ui-button ui-widget ui-corner-left ui-button-icon-only" title="Button with icon only">
150-
<span class="ui-icon ui-icon-gear"></span>
151-
Button with icon only
152-
</button>
153-
<button class="ui-button ui-widget ui-icon-beginning">
154-
<span class="ui-icon ui-icon-triangle-1-w"></span>
155-
Button with icon on the left
156-
</button>
157-
<button class="ui-button ui-widget ui-icon-end">
158-
<span class="ui-icon ui-icon-triangle-1-e"></span>
159-
Button with icon on the right
160-
</button>
161-
<button class="ui-button ui-widget">
162-
Button with icon on bottom
163-
</button>
164-
<button class="ui-button ui-widget ui-corner-right">
165-
Button with icon on top
166-
</button>
167-
</div>
168-
<br/>
169-
<div class="ui-controlgroup ui-controlgroup-vertical">
170-
<button class="ui-button ui-widget ui-corner-top ui-button-icon-only" title="Button with icon only">
171-
<span class="ui-icon ui-icon-gear"></span>
172-
Button with icon only
173-
</button>
174-
<button class="ui-button ui-widget ui-icon-beginning">
175-
<span class="ui-icon ui-icon-triangle-1-w"></span>
176-
Button with icon on the left
177-
</button>
178-
<button class="ui-button ui-widget ui-icon-end">
179-
<span class="ui-icon ui-icon-triangle-1-e"></span>
180-
Button with icon on the right
181-
</button>
182-
<button class="ui-button ui-widget ui-icon-bottom">
183-
<span class="ui-icon ui-icon-triangle-1-s"></span>
184-
Button with icon on bottom
185-
</button>
186-
<button class="ui-button ui-widget ui-corner-bottom ui-icon-top">
187-
<span class="ui-icon ui-icon-triangle-1-n"></span>
188-
Button with icon on top
189-
</button>
190-
</div>
191-
</div>
192-
>>>>>>> 14168e2... Controlgroup: Inital commit of new widget
19388
</body>
19489
</html>

demos/controlgroup/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99

1010
<ul>
1111
<li><a href="default.html">Default functionality</a></li>
12-
<<<<<<< HEAD
1312
<li><a href="splitbutton.html">Split Button</a></li>
14-
=======
15-
>>>>>>> c21dcbd... Controlgroup: Updating last refrences from buttonset to controlgroup
1613
<li><a href="toolbar.html">Toolbar</a></li>
1714
</ul>
1815

tests/unit/button/button.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<title>jQuery UI Button Test Suite</title>
66

77
<script src="../../jquery.js"></script>
8+
<script>
9+
$.uiBackCompat = false;
10+
</script>
811
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
912
<script src="../../../external/qunit/qunit.js"></script>
1013
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
TestHelpers.commonWidgetTests( "button", {
2+
defaults: {
3+
disabled: null,
4+
showLabel: true,
5+
label: null,
6+
icon: null,
7+
iconPosition: "beginning",
8+
text: true,
9+
icons: {
10+
primary: null,
11+
secondary: null
12+
},
13+
classes: {
14+
"ui-button": "ui-corner-all",
15+
"ui-button-icon-only": "",
16+
"ui-button-icon": ""
17+
},
18+
19+
// Callbacks
20+
create: null
21+
}
22+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* button_core.js
3+
*/
4+
5+
6+
(function($) {
7+
8+
module( "Button: core deprecated" );
9+
10+
11+
12+
})(jQuery);
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>jQuery UI Button Test Suite</title>
6+
7+
<script src="../../jquery.js"></script>
8+
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
9+
<script src="../../../external/qunit/qunit.js"></script>
10+
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
11+
<script src="../testsuite.js"></script>
12+
<script>
13+
TestHelpers.loadResources({
14+
css: [ "core", "button" ],
15+
js: [
16+
"ui/core.js",
17+
"ui/widget.js",
18+
"ui/button.js"
19+
]
20+
});
21+
</script>
22+
23+
<script src="button_common_deprecated.js"></script>
24+
<script src="button_core.js"></script>
25+
<script src="button_core_deprecated.js"></script>
26+
<script src="button_events.js"></script>
27+
<script src="button_methods.js"></script>
28+
<script src="button_options.js"></script>
29+
30+
<script src="../swarminject.js"></script>
31+
</head>
32+
<body>
33+
34+
<div id="qunit"></div>
35+
<div id="qunit-fixture">
36+
37+
<div><button id="button">Label</button></div>
38+
39+
<div id="radio0" style="margin-top: 2em;">
40+
<input type="radio" id="radio01" name="radio" checked="checked"><label for="radio01">Choice 1</label>
41+
<input type="radio" id="radio02" name="radio"><label for="radio02">Choice 2</label>
42+
<input type="radio" id="radio03" name="radio"><label for="radio03">Choice 3</label>
43+
</div>
44+
<div id="checkbox0">
45+
<input type="checkbox" id="checkbox01" name="checkbox"><label for="checkbox01">Choice 1</label>
46+
<input type="checkbox" id="checkbox02" name="checkbox"><label for="checkbox02">Choice 2</label>
47+
<input type="checkbox" id="checkbox03" name="checkbox"><label for="checkbox03">Choice 3</label>
48+
</div>
49+
<form>
50+
<div id="radio1" style="margin-top: 2em;">
51+
<input type="radio" id="radio11" name="radio"><label for="radio11">Choice 1</label>
52+
<input type="radio" id="radio12" name="radio" checked="checked"><label for="radio12">Choice 2</label>
53+
<input type="radio" id="radio13" name="radio"><label for="radio13">Choice 3</label>
54+
</div>
55+
</form>
56+
<form>
57+
<div id="radio2" style="margin-top: 2em;">
58+
<input type="radio" id="radio21" name="radio"><label for="radio21">Choice 1</label>
59+
<input type="radio" id="radio22" name="radio"><label for="radio22">Choice 2</label>
60+
<input type="radio" id="radio23" name="radio" checked="checked"><label for="radio23">Choice 3</label>
61+
</div>
62+
</form>
63+
<form>
64+
<div id="radio3">
65+
<input type="radio" id="radio31" name="data['Page']['parse']"><label for="radio31">Choice 1</label>
66+
<input type="radio" id="radio32" name="data['Page']['parse']" checked="checked"><label for="radio32">Choice 2</label>
67+
<input type="radio" id="radio33" name="data['Page']['parse']"><label for="radio33">Choice 3</label>
68+
</div>
69+
</form>
70+
71+
<input type="checkbox" id="check"><label for="check">Toggle</label>
72+
<input type="checkbox" id="check2"><label for="check2">Checkbox</label>
73+
74+
<div><input id="submit" type="submit" value="Label"></div>
75+
76+
<button id="button1">Button</button>
77+
78+
</div>
79+
</body>
80+
</html>

ui/button.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $.widget( "ui.button", {
6262
this.isInput = this.element.is( "input" );
6363
this.originalLabel = this.isInput ? this.element.val() : this.element.html();
6464

65-
disabled = this.element.prop( "disabled" );
65+
disabled = this.element[ 0 ].disabled;
6666
if ( disabled != null ) {
6767
options.disabled = disabled;
6868
}
@@ -83,7 +83,7 @@ $.widget( "ui.button", {
8383
formElement.on( "reset" + this.eventNamespace, formResetHandler );
8484

8585
if ( this.options.disabled == null ) {
86-
this.options.disabled = this.element.prop( "disabled" ) || false;
86+
this.options.disabled = this.element[ 0 ].disabled || false;
8787
}
8888

8989
this.hasTitle = this.element.attr( "title" );
@@ -212,7 +212,8 @@ $.widget( "ui.button", {
212212
}
213213
this._super( key, value );
214214
if ( key === "disabled" ) {
215-
this.element.toggleClass( "ui-state-disabled", value ).prop( "disabled", value ).blur();
215+
this.element.toggleClass( "ui-state-disabled", value )[ 0 ].disabled = value;
216+
this.element.blur();
216217
}
217218
},
218219

@@ -221,7 +222,7 @@ $.widget( "ui.button", {
221222
// Make sure to only check disabled if its an element that supports this otherwise
222223
// check for the disabled class to determine state
223224
var isDisabled = this.element.is( "input, button" ) ?
224-
this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
225+
this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
225226

226227
if ( isDisabled !== this.options.disabled ) {
227228
this._setOptions({ "disabled": isDisabled });
@@ -232,7 +233,7 @@ $.widget( "ui.button", {
232233
});
233234

234235
// DEPRECATED
235-
if ( $.uiBackCompat === false ) {
236+
if ( $.uiBackCompat !== false ) {
236237

237238
// Text and Icons options
238239
$.widget( "ui.button", $.ui.button, {
@@ -279,7 +280,7 @@ if ( $.uiBackCompat === false ) {
279280
});
280281
$.fn.button = (function( orig ) {
281282
return function() {
282-
if ( this[ 0 ].tagName === "input" && ( this.attr( "type") === "checkbox" ||
283+
if ( this.tagName === "input" && ( this.attr( "type") === "checkbox" ||
283284
this.attr( "type" ) === "radio" ) ) {
284285
if ( $.ui.checkboxradio ) {
285286
if ( arguments.length === 0 ) {

0 commit comments

Comments
 (0)