Skip to content

Commit 1e225e7

Browse files
committed
Button: updating tests
1 parent f55d4ce commit 1e225e7

File tree

8 files changed

+20
-34
lines changed

8 files changed

+20
-34
lines changed

tests/unit/button/button.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div id="qunit"></div>
3434
<div id="qunit-fixture">
3535

36-
<div><button id="button" class="foo">Label</button></div>
36+
<div><button id="button">Label</button></div>
3737

3838
<div id="radio0" style="margin-top: 2em;">
3939
<input type="radio" id="radio01" name="radio" checked="checked"><label for="radio01">Choice 1</label>

tests/unit/button/button_common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ TestHelpers.commonWidgetTests( "button", {
44
showLabel: true,
55
label: null,
66
icon: null,
7-
iconPosition: "begining",
7+
iconPosition: "beginning",
88

9-
// callbacks
9+
// Callbacks
1010
create: null
1111
}
1212
});

tests/unit/button/button_core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() {
2525
ok( !element.is( ":focus" ),
2626
"button has had focus removed" );
2727
start();
28-
},100);
28+
});
2929
});
3030

3131
})(jQuery);

tests/unit/button/button_options.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,33 @@ test( "disabled, explicit value", function() {
2828
test("disabled, null", function() {
2929
expect( 4 );
3030
$("#radio01").button({ disabled: null });
31-
deepEqual( $("#radio01").button("option", "disabled"), false,
31+
strictEqual( $("#radio01").button("option", "disabled"), false,
3232
"disabled option set to false");
33-
deepEqual(false, $("#radio01").prop("disabled"), "element is disabled");
33+
strictEqual( $("#radio01").prop("disabled"), false, "element is disabled");
3434

3535
$("#radio02").prop("disabled", true).button({ disabled: null });
3636
deepEqual(true, $("#radio02").button("option", "disabled"),
3737
"disabled option set to true");
3838
deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled");
3939
});
4040

41-
test("text false without icon", function() {
41+
test("showLabel false without icon", function() {
4242
expect( 1 );
4343
$("#button").button({
4444
showLabel: false
4545
});
46-
ok( $("#button").is(":not(.ui-button-icon-only)") );
46+
strictEqual( $("#button").attr( "class" ), "ui-button ui-widget ui-corner-all" );
4747

4848
$("#button").button("destroy");
4949
});
5050

51-
test("text false with icon", function() {
51+
test("showLabel false with icon", function() {
5252
expect( 1 );
5353
$("#button").button({
5454
showLabel: false,
5555
icon: "iconclass"
5656
});
57-
ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") );
57+
strictEqual( $("#button").attr( "class" ), "ui-button ui-widget ui-corner-all ui-icon-beginning ui-button-icon-only" );
5858

5959
$("#button").button("destroy");
6060
});
@@ -100,20 +100,9 @@ test("icons", function() {
100100
showLabel: false,
101101
icon: "iconclass"
102102
});
103-
ok( $("#button").is(":has(span.ui-icon.iconclass)") );
103+
strictEqual( $("#button").find("span.ui-icon.iconclass").length, 1 );
104104

105105
$("#button").button("destroy");
106106
});
107107

108-
test( "#5295 - button does not remove hoverstate if disabled" , function() {
109-
expect( 1 );
110-
var btn = $("#button").button();
111-
btn.hover( function() {
112-
btn.button( "disable" );
113-
});
114-
btn.trigger( "mouseenter" );
115-
btn.trigger( "mouseleave" );
116-
ok( !btn.is( ".ui-state-hover") );
117-
});
118-
119108
})(jQuery);

tests/unit/checkboxradio/checkboxradio.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<script src="../testsuite.js"></script>
1212
<script>
1313
TestHelpers.loadResources({
14-
css: [ "ui.core", "ui.button", "ui.checkboxradio" ],
14+
css: [ "core", "ui.button", "ui.checkboxradio" ],
1515
js: [
1616
"ui/core.js",
1717
"ui/widget.js",
@@ -27,14 +27,10 @@
2727
</head>
2828
<body>
2929

30-
<h1 id="qunit-header">jQuery UI Button Test Suite</h1>
31-
<h2 id="qunit-banner"></h2>
32-
<div id="qunit-testrunner-toolbar"></div>
33-
<h2 id="qunit-userAgent"></h2>
34-
<ol id="qunit-tests"></ol>
30+
<div id="qunit"></div>
3531
<div id="qunit-fixture">
3632

37-
<div id="radio0" style="margin-top: 2em;">
33+
<div id="radio0">
3834
<input type="radio" id="radio01" name="radio" checked="checked"><label for="radio01">Choice 1</label>
3935
<input type="radio" id="radio02" name="radio"><label for="radio02">Choice 2</label>
4036
<input type="radio" id="radio03" name="radio"><label for="radio03">Choice 3</label>

tests/unit/checkboxradio/checkboxradio_core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ test("checkbox", function() {
1010
expect( 4 );
1111
var input = $("#check"),
1212
label = $("label[for=check]");
13-
ok( input.is(":visible") );
14-
ok( label.is(":not(.ui-button)") );
13+
ok( input.is( ":visible" ) );
14+
ok( !label.hasClass(".ui-button)") );
1515
input.checkboxradio();
16-
ok( input.is(".ui-helper-hidden-accessible") );
17-
ok( label.is(".ui-button") );
16+
strictEqual( input.attr( "class" ), "ui-helper-hidden-accessible ui-checkboxradio" );
17+
strictEqual( label.attr( "class" ), "ui-button ui-widget ui-corner-all ui-checkbox-label" );
1818
});
1919

2020
test("radios", function() {

tests/unit/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ <h2>Widgets</h2>
4040
<li><a href="accordion/accordion.html">Accordion</a></li>
4141
<li><a href="autocomplete/autocomplete.html">Autocomplete</a></li>
4242
<li><a href="button/button.html">Button</a></li>
43+
<li><a href="checkboxradio/checkboxradio.html">Button</a></li>
4344
<li><a href="datepicker/datepicker.html">Datepicker</a></li>
4445
<li><a href="dialog/dialog.html">Dialog</a></li>
4546
<li><a href="menu/menu.html">Menu</a></li>

ui/checkboxradio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ $.widget( "ui.checkboxradio", {
4545
options: {
4646
disabled: null,
4747
label: null,
48-
icon: null
48+
icon: false
4949
},
5050

5151
_getCreateOptions: function() {

0 commit comments

Comments
 (0)