Skip to content

Commit 64b786f

Browse files
committed
(fix) Tests: Replace resource loader with AMD
- Port all others;
1 parent 7655302 commit 64b786f

Some content is hidden

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

42 files changed

+198
-161
lines changed

tests/unit/position/position.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
<meta charset="utf-8">
55
<title>jQuery UI Position Test Suite</title>
66

7-
<script src="../helper/css.js"></script>
8-
<script>
9-
window.helper.loadCss([ "ui/position.js" ]);
10-
</script>
11-
127
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
138
</head>
149
<body>

tests/unit/position/position_core.js

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

67
var win = $( window ),
78
scrollTopSupport = function() {
@@ -19,7 +20,7 @@ module( "position", {
1920
}
2021
});
2122

22-
TestHelpers.testJshint( "position" );
23+
testHelper.testJshint( "position" );
2324

2425
test( "my, at, of", function() {
2526
expect( 4 );
@@ -729,4 +730,4 @@ test( "bug #5280: consistent results (avoid fractional values)", function() {
729730
deepEqual( offset1, offset2 );
730731
});
731732

732-
}(;
733+
});

tests/unit/progressbar/progressbar_common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
define([
2-
"helper/testsuite"
2+
"helper/testsuite",
3+
"ui/progressbar"
34
], function( testHelper ) {
45

56
testHelper.commonWidgetTests( "progressbar", {

tests/unit/progressbar/progressbar_methods.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
define([
22
"jquery",
3+
"helper/testsuite",
34
"ui/progressbar"
4-
], function( $ ) {
5+
], function( $, testHelper ) {
56

67
module( "progressbar: methods" );
78

89
test( "destroy", function() {
910
expect( 1 );
10-
domEqual( "#progressbar", function() {
11+
testHelper.domEqual( "#progressbar", function() {
1112
$( "#progressbar" ).progressbar().progressbar( "destroy" );
1213
});
1314
});

tests/unit/resizable/resizable_common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
define([
2-
"helper/testsuite"
2+
"helper/testsuite",
3+
"ui/resizable"
34
], function( testHelper ) {
45

56
testHelper.commonWidgetTests( "resizable", {

tests/unit/resizable/resizable_core.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
define([
22
"jquery",
3+
"./resizable_test_helpers",
34
"ui/resizable"
4-
], function( $ ) {
5+
], function( $, resizableTestHelper ) {
56

67
/*
78
* resizable_core.js
@@ -33,10 +34,10 @@ test("n", function() {
3334

3435
var handle = ".ui-resizable-n", target = $("#resizable1").resizable({ handles: "all" });
3536

36-
TestHelpers.resizable.drag(handle, 0, -50);
37+
resizableTestHelper.drag(handle, 0, -50);
3738
equal( target.height(), 150, "compare height" );
3839

39-
TestHelpers.resizable.drag(handle, 0, 50);
40+
resizableTestHelper.drag(handle, 0, 50);
4041
equal( target.height(), 100, "compare height" );
4142

4243
equal( target[0].style.left, "", "left should not be modified" );
@@ -48,10 +49,10 @@ test("s", function() {
4849

4950
var handle = ".ui-resizable-s", target = $("#resizable1").resizable({ handles: "all" });
5051

51-
TestHelpers.resizable.drag(handle, 0, 50);
52+
resizableTestHelper.drag(handle, 0, 50);
5253
equal( target.height(), 150, "compare height" );
5354

54-
TestHelpers.resizable.drag(handle, 0, -50);
55+
resizableTestHelper.drag(handle, 0, -50);
5556
equal( target.height(), 100, "compare height" );
5657

5758
equal( target[0].style.top, "", "top should not be modified" );
@@ -64,10 +65,10 @@ test("e", function() {
6465

6566
var handle = ".ui-resizable-e", target = $("#resizable1").resizable({ handles: "all" });
6667

67-
TestHelpers.resizable.drag(handle, 50);
68+
resizableTestHelper.drag(handle, 50);
6869
equal( target.width(), 150, "compare width");
6970

70-
TestHelpers.resizable.drag(handle, -50);
71+
resizableTestHelper.drag(handle, -50);
7172
equal( target.width(), 100, "compare width" );
7273

7374
equal( target[0].style.height, "", "height should not be modified" );
@@ -80,10 +81,10 @@ test("w", function() {
8081

8182
var handle = ".ui-resizable-w", target = $("#resizable1").resizable({ handles: "all" });
8283

83-
TestHelpers.resizable.drag(handle, -50);
84+
resizableTestHelper.drag(handle, -50);
8485
equal( target.width(), 150, "compare width" );
8586

86-
TestHelpers.resizable.drag(handle, 50);
87+
resizableTestHelper.drag(handle, 50);
8788
equal( target.width(), 100, "compare width" );
8889

8990
equal( target[0].style.height, "", "height should not be modified" );
@@ -95,11 +96,11 @@ test("ne", function() {
9596

9697
var handle = ".ui-resizable-ne", target = $("#resizable1").css({ overflow: "hidden" }).resizable({ handles: "all" });
9798

98-
TestHelpers.resizable.drag(handle, -50, -50);
99+
resizableTestHelper.drag(handle, -50, -50);
99100
equal( target.width(), 50, "compare width" );
100101
equal( target.height(), 150, "compare height" );
101102

102-
TestHelpers.resizable.drag(handle, 50, 50);
103+
resizableTestHelper.drag(handle, 50, 50);
103104
equal( target.width(), 100, "compare width" );
104105
equal( target.height(), 100, "compare height" );
105106

@@ -111,11 +112,11 @@ test("se", function() {
111112

112113
var handle = ".ui-resizable-se", target = $("#resizable1").resizable({ handles: "all" });
113114

114-
TestHelpers.resizable.drag(handle, 50, 50);
115+
resizableTestHelper.drag(handle, 50, 50);
115116
equal( target.width(), 150, "compare width" );
116117
equal( target.height(), 150, "compare height" );
117118

118-
TestHelpers.resizable.drag(handle, -50, -50);
119+
resizableTestHelper.drag(handle, -50, -50);
119120
equal( target.width(), 100, "compare width" );
120121
equal( target.height(), 100, "compare height" );
121122

@@ -128,11 +129,11 @@ test("sw", function() {
128129

129130
var handle = ".ui-resizable-sw", target = $("#resizable1").resizable({ handles: "all" });
130131

131-
TestHelpers.resizable.drag(handle, -50, -50);
132+
resizableTestHelper.drag(handle, -50, -50);
132133
equal( target.width(), 150, "compare width" );
133134
equal( target.height(), 50, "compare height" );
134135

135-
TestHelpers.resizable.drag(handle, 50, 50);
136+
resizableTestHelper.drag(handle, 50, 50);
136137
equal( target.width(), 100, "compare width" );
137138
equal( target.height(), 100, "compare height" );
138139

@@ -144,11 +145,11 @@ test("nw", function() {
144145

145146
var handle = ".ui-resizable-nw", target = $("#resizable1").resizable({ handles: "all" });
146147

147-
TestHelpers.resizable.drag(handle, -50, -50);
148+
resizableTestHelper.drag(handle, -50, -50);
148149
equal( target.width(), 150, "compare width" );
149150
equal( target.height(), 150, "compare height" );
150151

151-
TestHelpers.resizable.drag(handle, 50, 50);
152+
resizableTestHelper.drag(handle, 50, 50);
152153
equal( target.width(), 100, "compare width" );
153154
equal( target.height(), 100, "compare height" );
154155
});
@@ -166,10 +167,10 @@ test("handle with complex markup (#8756)", function() {
166167

167168
var handle = ".ui-resizable-w div", target = $("#resizable1").resizable({ handles: "all" });
168169

169-
TestHelpers.resizable.drag(handle, -50);
170+
resizableTestHelper.drag(handle, -50);
170171
equal( target.width(), 150, "compare width" );
171172

172-
TestHelpers.resizable.drag(handle, 50);
173+
resizableTestHelper.drag(handle, 50);
173174
equal( target.width(), 100, "compare width" );
174175
});
175176

@@ -189,7 +190,7 @@ test("resizable accounts for scroll position correctly (#3815)", function() {
189190
left = el.css("left");
190191
top = el.css("top");
191192

192-
TestHelpers.resizable.drag(handle, 50, 50);
193+
resizableTestHelper.drag(handle, 50, 50);
193194
deepEqual( el.position(), position, "position stays the same when resized" );
194195
equal( el.css("left"), left, "css('left') stays the same when resized" );
195196
equal( el.css("top"), top, "css('top') stays the same when resized" );
@@ -206,7 +207,7 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi
206207
grid: [ 10, 10 ]
207208
});
208209

209-
TestHelpers.resizable.drag( handle, 1, 1 );
210+
resizableTestHelper.drag( handle, 1, 1 );
210211
equal( target.width(), 100, "compare width" );
211212
equal( target.height(), 100, "compare height" );
212213
});
@@ -230,14 +231,14 @@ test( "nested resizable", function() {
230231
innerHandle = $( "#inner > .ui-resizable-e" );
231232
outerHandle = $( "#outer > .ui-resizable-e" );
232233

233-
TestHelpers.resizable.drag( innerHandle, 10 );
234+
resizableTestHelper.drag( innerHandle, 10 );
234235
equal( inner.width(), 40, "compare width of inner element" );
235-
TestHelpers.resizable.drag( innerHandle, -10 );
236+
resizableTestHelper.drag( innerHandle, -10 );
236237
equal( inner.width(), 30, "compare width of inner element" );
237238

238-
TestHelpers.resizable.drag( outerHandle, 10 );
239+
resizableTestHelper.drag( outerHandle, 10 );
239240
equal( outer.width(), 60, "compare width of outer element" );
240-
TestHelpers.resizable.drag( outerHandle, -10 );
241+
resizableTestHelper.drag( outerHandle, -10 );
241242
equal( outer.width(), 50, "compare width of outer element" );
242243

243244
inner.remove();

tests/unit/resizable/resizable_events.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
define([
22
"jquery",
3+
"./resizable_test_helpers",
34
"ui/resizable"
4-
], function( $ ) {
5+
], function( $, resizableTestHelper ) {
56

67
/*
78
* resizable_events.js
@@ -27,7 +28,7 @@ test("start", function() {
2728
}
2829
});
2930

30-
TestHelpers.resizable.drag(handle, 50, 50);
31+
resizableTestHelper.drag(handle, 50, 50);
3132

3233
equal(count, 1, "start callback should happen exactly once");
3334

@@ -58,7 +59,7 @@ test( "resize", function() {
5859
}
5960
});
6061

61-
TestHelpers.resizable.drag( handle, 50, 50 );
62+
resizableTestHelper.drag( handle, 50, 50 );
6263

6364
equal( count, 2, "resize callback should happen exactly once per size adjustment" );
6465

@@ -86,7 +87,7 @@ test( "resize (min/max dimensions)", function() {
8687
}
8788
});
8889

89-
TestHelpers.resizable.drag( handle, -200, -200 );
90+
resizableTestHelper.drag( handle, -200, -200 );
9091

9192
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
9293

@@ -116,10 +117,10 @@ test( "resize (containment)", function() {
116117
});
117118

118119
// Prove you can't resize outside containment by dragging southeast corner southeast
119-
TestHelpers.resizable.drag( handle, 100, 100 );
120+
resizableTestHelper.drag( handle, 100, 100 );
120121

121122
// Prove you can't resize outside containment by dragging southeast corner northwest
122-
TestHelpers.resizable.drag( handle, -200, -200 );
123+
resizableTestHelper.drag( handle, -200, -200 );
123124

124125
equal( count, 1, "resize callback should happen exactly once per size adjustment" );
125126

@@ -144,7 +145,7 @@ test("resize (grid)", function() {
144145
}
145146
});
146147

147-
TestHelpers.resizable.drag(handle, 50, 50);
148+
resizableTestHelper.drag(handle, 50, 50);
148149

149150
equal(count, 1, "resize callback should happen exactly once per grid-unit size adjustment");
150151

@@ -163,7 +164,7 @@ test( "resize, custom adjustment", function() {
163164
}
164165
});
165166

166-
TestHelpers.resizable.drag( handle, 50, 50 );
167+
resizableTestHelper.drag( handle, 50, 50 );
167168

168169
equal( element.width(), 100, "resize event can control width" );
169170
equal( element.height(), 200, "resize event can control height" );
@@ -189,7 +190,7 @@ test("stop", function() {
189190
}
190191
});
191192

192-
TestHelpers.resizable.drag(handle, 50, 50);
193+
resizableTestHelper.drag(handle, 50, 50);
193194

194195
equal(count, 1, "stop callback should happen exactly once");
195196

@@ -234,7 +235,7 @@ test( "resize (containment) works with parent with negative offset", function()
234235

235236
widthBefore = target.width();
236237

237-
TestHelpers.resizable.drag( handle, increaseWidthBy, 0 );
238+
resizableTestHelper.drag( handle, increaseWidthBy, 0 );
238239

239240
widthAfter = target.width();
240241

0 commit comments

Comments
 (0)