Skip to content

Commit 23a7a11

Browse files
committed
Widget: Convert tests to new infrastructure
Ref #10119 Ref gh-1528
1 parent 94f5c15 commit 23a7a11

File tree

5 files changed

+33
-29
lines changed

5 files changed

+33
-29
lines changed

tests/unit/widget/widget.html

+8-20
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Widget 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" ],
16-
js: [
17-
"ui/widget.js"
18-
]
19-
});
7+
<script src="../../lib/css.js" data-modules="core"></script>
8+
<script src="../../lib/bootstrap.js"
9+
data-modules="
10+
widget_core
11+
widget_extend
12+
widget_animation
13+
widget_classes
14+
">
2015
</script>
21-
22-
<script src="widget_core.js"></script>
23-
<script src="widget_extend.js"></script>
24-
<script src="widget_animation.js"></script>
25-
<script src="widget_classes.js"></script>
26-
27-
<script src="../swarminject.js"></script>
2816
</head>
2917
<body>
3018

tests/unit/widget/widget_animation.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
define( [
2+
"jquery",
3+
"ui/widget"
4+
], function( $ ) {
15

26
module( "widget animation", (function() {
37
var show = $.fn.show,
@@ -255,3 +259,5 @@ asyncTest( "show: object(effect)", function() {
255259
next();
256260
});
257261
});
262+
263+
} );

tests/unit/widget/widget_classes.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(function( $ ) {
1+
define( [
2+
"jquery",
3+
"ui/widget"
4+
], function( $ ) {
25

36
module( "widget factory classes", {
47
setup: function() {
@@ -115,10 +118,10 @@ test( ".option() - classes setter", function( assert ) {
115118
"Appending a class to the current value works as expected" );
116119
});
117120

118-
test( ".destroy() - class removal", function() {
121+
test( ".destroy() - class removal", function( assert ) {
119122
expect( 1 );
120123

121-
domEqual( "#widget", function() {
124+
assert.domEqual( "#widget", function() {
122125
$( "#widget" ).classesWidget().classesWidget( "destroy" );
123126
});
124127
});
@@ -140,4 +143,4 @@ test( "._add/_remove/_toggleClass()", function( assert ) {
140143
elementLacksClasses( widget, "remove", assert );
141144
});
142145

143-
}( jQuery ) );
146+
} );

tests/unit/widget/widget_core.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
(function( $ ) {
1+
define( [
2+
"jquery",
3+
"lib/common",
4+
"ui/widget"
5+
], function( $, common ) {
26

37
module( "widget factory", {
48
teardown: function() {
@@ -9,7 +13,7 @@ module( "widget factory", {
913
}
1014
});
1115

12-
TestHelpers.testJshint( "widget" );
16+
common.testJshint( "widget" );
1317

1418
test( "widget creation", function() {
1519
expect( 5 );
@@ -1507,4 +1511,4 @@ test( "$.widget.bridge() - widgetFullName", function() {
15071511
equal( typeof instance, "object", "instance stored in .data(widgetFullName)" );
15081512
});
15091513

1510-
}( jQuery ) );
1514+
} );

tests/unit/widget/widget_extend.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(function( $ ) {
1+
define( [
2+
"jquery",
3+
"ui/widget"
4+
], function( $ ) {
25

36
test( "$.widget.extend()", function() {
47
expect( 27 );
@@ -106,4 +109,4 @@ test( "$.widget.extend()", function() {
106109
deepEqual( input, output, "don't clone arrays" );
107110
});
108111

109-
}( jQuery ));
112+
} );

0 commit comments

Comments
 (0)