Skip to content

Commit 9c3d95c

Browse files
committed
(fix) Tests: Replace resource loader with AMD
- Port all others;
1 parent cdfc27e commit 9c3d95c

File tree

115 files changed

+1217
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1217
-822
lines changed

tests/unit/accordion/accordion_core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
define([
22
"jquery",
33
"./accordion_test_helpers",
4-
"ui/accordion",
5-
"jquery.simulate"
4+
"jquery.simulate",
5+
"ui/accordion"
66
], function( $, accordionTestHelper ) {
77

88
var setupTeardown = accordionTestHelper.setupTeardown,

tests/unit/button/button.html

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,12 @@
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>
7+
<script src="../helper/css.js"></script>
128
<script>
13-
TestHelpers.loadResources({
14-
css: [ "core", "button" ],
15-
js: [
16-
"ui/core.js",
17-
"ui/widget.js",
18-
"ui/button.js"
19-
]
20-
});
9+
window.helper.loadCss([ "core", "button" ]);
2110
</script>
2211

23-
<script src="button_common.js"></script>
24-
<script src="button_core.js"></script>
25-
<script src="button_events.js"></script>
26-
<script src="button_methods.js"></script>
27-
<script src="button_options.js"></script>
28-
29-
<script src="../swarminject.js"></script>
12+
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
3013
</head>
3114
<body>
3215

@@ -75,5 +58,24 @@
7558
<button id="button1">Button</button>
7659

7760
</div>
61+
62+
<script src="../../../external/requirejs/require.js"></script>
63+
<script src="../../../external/qunit/qunit.js"></script>
64+
<script src="../swarminject.js"></script>
65+
<script src="../helper/jquery.js"></script>
66+
<script src="../helper/require.js"></script>
67+
<script>
68+
QUnit.config.autostart = false;
69+
require_series([
70+
"./button_common",
71+
"./button_core",
72+
"./button_events",
73+
"./button_methods",
74+
"./button_options"
75+
], function() {
76+
QUnit.start();
77+
});
78+
</script>
79+
7880
</body>
7981
</html>

tests/unit/button/button_common.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
TestHelpers.commonWidgetTests( "button", {
1+
define([
2+
"helper/testsuite",
3+
"ui/button"
4+
], function( testHelper ) {
5+
6+
testHelper.commonWidgetTests( "button", {
27
defaults: {
38
disabled: null,
49
icons: {
@@ -12,3 +17,5 @@ TestHelpers.commonWidgetTests( "button", {
1217
create: null
1318
}
1419
});
20+
21+
});

tests/unit/button/button_core.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
define([
2+
"jquery",
3+
"jquery.simulate",
4+
"ui/button"
5+
], function( $ ) {
6+
17
/*
28
* button_core.js
39
*/
410

5-
6-
(function($) {
7-
811
module("button: core");
912

1013
test("checkbox", function() {
@@ -223,4 +226,4 @@ asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() {
223226
});
224227
});
225228

226-
})(jQuery);
229+
});

tests/unit/button/button_events.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
define([
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
5+
16
/*
27
* button_events.js
38
*/
4-
(function($) {
59

610
module("button: events");
711

@@ -33,4 +37,4 @@ asyncTest( "when button loses focus, ensure active state is removed (#8559)", fu
3337
});
3438
});
3539

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

tests/unit/button/button_methods.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
define([
2+
"jquery",
3+
"helper/testsuite",
4+
"ui/button"
5+
], function( $, testHelper ) {
6+
17
/*
28
* button_methods.js
39
*/
4-
(function($) {
5-
610

711
module("button: methods");
812

913
test("destroy", function() {
1014
expect( 1 );
11-
domEqual( "#button", function() {
15+
testHelper.domEqual( "#button", function() {
1216
$( "#button" ).button().button( "destroy" );
1317
});
1418
});
@@ -71,4 +75,4 @@ test( "refresh: buttonset should turn added elements into button widgets", funct
7175
equal( checkboxButtonset.find( ":ui-button" ).length, 4, "checkbox" );
7276
});
7377

74-
})(jQuery);
78+
});

tests/unit/button/button_options.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
define([
2+
"jquery",
3+
"ui/button"
4+
], function( $ ) {
5+
16
/*
27
* button_options.js
38
*/
4-
(function($) {
59

610
module( "button: options" );
711

@@ -156,4 +160,4 @@ test( "#5295 - button does not remove hoverstate if disabled" , function() {
156160
ok( !btn.is( ".ui-state-hover") );
157161
});
158162

159-
})(jQuery);
163+
});

tests/unit/core/core.html

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,7 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Core Test Suite</title>
66

7-
<script src="../../jquery.js"></script>
87
<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-
js: [ "ui/core.js" ]
15-
});
16-
</script>
17-
18-
<script src="core.js"></script>
19-
<script src="selector.js"></script>
20-
21-
<script src="../swarminject.js"></script>
228
<style>
239
.zindex {
2410
z-index: 100;
@@ -121,5 +107,21 @@
121107
<div id="dimensions" style="float: left; height: 50px; width: 100px; margin: 1px 12px 11px 2px; border-style: solid; border-width: 3px 14px 13px 4px; padding: 5px 16px 15px 6px;"></div>
122108

123109
</div>
110+
111+
<script src="../../../external/requirejs/require.js"></script>
112+
<script src="../../../external/qunit/qunit.js"></script>
113+
<script src="../swarminject.js"></script>
114+
<script src="../helper/jquery.js"></script>
115+
<script src="../helper/require.js"></script>
116+
<script>
117+
QUnit.config.autostart = false;
118+
require_series([
119+
"./core",
120+
"./selector"
121+
], function() {
122+
QUnit.start();
123+
});
124+
</script>
125+
124126
</body>
125127
</html>

tests/unit/core/core.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
(function( $ ) {
1+
define([
2+
"jquery",
3+
"helper/testsuite",
4+
"ui/core"
5+
], function( $, testHelper ) {
26

37
module( "core - jQuery extensions" );
48

5-
TestHelpers.testJshint( "core" );
9+
testHelper.testJshint( "core" );
610

711
test( "innerWidth - getter", function() {
812
expect( 2 );
@@ -141,4 +145,4 @@ test( "uniqueId / removeUniqueId", function() {
141145
ok( !el.attr( "id" ), "unique id has been removed from element" );
142146
});
143147

144-
})( jQuery );
148+
});

tests/unit/core/core_deprecated.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,7 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Core Test Suite</title>
66

7-
<script src="../../jquery.js"></script>
87
<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-
js: [ "ui/core.js" ]
15-
});
16-
</script>
17-
18-
<script src="core.js"></script>
19-
<script src="selector.js"></script>
20-
<script src="core_deprecated.js"></script>
21-
22-
<script src="../swarminject.js"></script>
238
<style>
249
.zindex {
2510
z-index: 100;
@@ -128,5 +113,22 @@
128113
<div id="dimensions" style="float: left; height: 50px; width: 100px; margin: 1px 12px 11px 2px; border-style: solid; border-width: 3px 14px 13px 4px; padding: 5px 16px 15px 6px;"></div>
129114

130115
</div>
116+
117+
<script src="../../../external/requirejs/require.js"></script>
118+
<script src="../../../external/qunit/qunit.js"></script>
119+
<script src="../swarminject.js"></script>
120+
<script src="../helper/jquery.js"></script>
121+
<script src="../helper/require.js"></script>
122+
<script>
123+
QUnit.config.autostart = false;
124+
require_series([
125+
"./core",
126+
"./selector",
127+
"./core_deprecated"
128+
], function() {
129+
QUnit.start();
130+
});
131+
</script>
132+
131133
</body>
132134
</html>

tests/unit/core/core_deprecated.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(function( $ ) {
1+
define([
2+
"jquery",
3+
"ui/core"
4+
], function( $ ) {
25

36
module( "core - deprecated" );
47

@@ -49,4 +52,4 @@ test( "zIndex", function() {
4952
equal( $( "#zIndexAutoNoParent" ).zIndex(), 0, "zIndex never explicitly set in hierarchy" );
5053
});
5154

52-
})( jQuery );
55+
});

tests/unit/core/selector.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
(function( $ ) {
1+
define([
2+
"jquery",
3+
"ui/core"
4+
], function( $ ) {
25

36
module( "core - selectors" );
47

@@ -251,4 +254,4 @@ test( "tabbable - dimensionless parent with overflow", function() {
251254
isTabbable( "#dimensionlessParent", "input" );
252255
});
253256

254-
})( jQuery );
257+
});

tests/unit/datepicker/datepicker.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,12 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Datepicker 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>
7+
<script src="../helper/css.js"></script>
128
<script>
13-
TestHelpers.loadResources({
14-
css: [ "core", "datepicker" ],
15-
js: [
16-
"ui/core.js",
17-
"ui/datepicker.js",
18-
"ui/i18n/datepicker-fr.js",
19-
"ui/i18n/datepicker-he.js",
20-
"ui/i18n/datepicker-zh-CN.js"
21-
]
22-
});
9+
window.helper.loadCss([ "core", "datepicker" ]);
2310
</script>
2411

25-
<script src="datepicker_common.js"></script>
26-
<script src="datepicker_core.js"></script>
27-
<script src="datepicker_events.js"></script>
28-
<script src="datepicker_methods.js"></script>
29-
<script src="datepicker_options.js"></script>
30-
<script src="datepicker_test_helpers.js"></script>
31-
32-
<script src="../swarminject.js"></script>
12+
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
3313
</head>
3414
<body>
3515

@@ -40,5 +20,25 @@
4020
<p><input type="text" id="inp2"></p>
4121

4222
</div>
23+
24+
<script src="../../../external/requirejs/require.js"></script>
25+
<script src="../../../external/qunit/qunit.js"></script>
26+
<script src="../swarminject.js"></script>
27+
<script src="../helper/jquery.js"></script>
28+
<script src="../helper/require.js"></script>
29+
<script>
30+
QUnit.config.autostart = false;
31+
require_series([
32+
"./datepicker_common",
33+
"./datepicker_core",
34+
"./datepicker_events",
35+
"./datepicker_methods",
36+
"./datepicker_options",
37+
"./datepicker_test_helpers"
38+
], function() {
39+
QUnit.start();
40+
});
41+
</script>
42+
4343
</body>
4444
</html>

0 commit comments

Comments
 (0)