Skip to content

Commit f908a77

Browse files
committed
Button: Convert tests to new infrastructure
Ref #10119 Ref jquerygh-1528
1 parent aff3c32 commit f908a77

File tree

6 files changed

+32
-48
lines changed

6 files changed

+32
-48
lines changed

tests/unit/button/button.html

+2-24
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,8 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Button Test Suite</title>
66

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 src="../../../external/qunit-assert-classes/qunit-assert-classes.js"></script>
13-
<script>
14-
TestHelpers.loadResources({
15-
css: [ "core", "button" ],
16-
js: [
17-
"ui/core.js",
18-
"ui/widget.js",
19-
"ui/button.js"
20-
]
21-
});
22-
</script>
23-
24-
<script src="button_common.js"></script>
25-
<script src="button_core.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>
7+
<script src="../../lib/css.js" data-modules="core button"></script>
8+
<script src="../../lib/bootstrap.js" data-widget="button"></script>
319
</head>
3210
<body>
3311

tests/unit/button/button_common.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
TestHelpers.commonWidgetTests( "button", {
1+
define( [
2+
"lib/common",
3+
"ui/button"
4+
], function( common ) {
5+
6+
common.testWidget( "button", {
27
defaults: {
38
classes: {},
49
disabled: null,
@@ -13,3 +18,5 @@ TestHelpers.commonWidgetTests( "button", {
1318
create: null
1419
}
1520
});
21+
22+
} );

tests/unit/button/button_core.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/*
2-
* button_core.js
3-
*/
4-
5-
(function($) {
1+
define( [
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
65

76
module("button: core");
87

@@ -228,4 +227,4 @@ asyncTest( "#9169 - Disabled button maintains ui-state-focus", function( assert
228227
});
229228
});
230229

231-
})(jQuery);
230+
} );

tests/unit/button/button_events.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*
2-
* button_events.js
3-
*/
4-
(function($) {
1+
define( [
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
55

66
module("button: events");
77

@@ -33,4 +33,4 @@ asyncTest( "when button loses focus, ensure active state is removed (#8559)", fu
3333
});
3434
});
3535

36-
})(jQuery);
36+
} );

tests/unit/button/button_methods.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/*
2-
* button_methods.js
3-
*/
4-
(function($) {
1+
define( [
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
55

66
module("button: methods");
77

8-
test("destroy", function() {
8+
test("destroy", function( assert ) {
99
expect( 1 );
10-
domEqual( "#button", function() {
10+
assert.domEqual( "#button", function() {
1111
$( "#button" ).button().button( "destroy" );
1212
});
1313
});
@@ -70,4 +70,4 @@ test( "refresh: buttonset should turn added elements into button widgets", funct
7070
equal( checkboxButtonset.find( ":ui-button" ).length, 4, "checkbox" );
7171
});
7272

73-
})(jQuery);
73+
} );

tests/unit/button/button_options.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*
2-
* button_options.js
3-
*/
4-
(function($) {
1+
define( [
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
55

66
module( "button: options" );
77

@@ -154,4 +154,4 @@ test( "#5295 - button does not remove hoverstate if disabled" , function( assert
154154
assert.lacksClasses( btn, "ui-state-hover" );
155155
});
156156

157-
})(jQuery);
157+
} );

0 commit comments

Comments
 (0)