@@ -13,13 +13,16 @@ function includeScript( url ) {
13
13
}
14
14
15
15
function url ( value ) {
16
- return value + ( / \? / . test ( value ) ? "&" : "?" ) + new Date ( ) . getTime ( ) + "" + parseInt ( Math . random ( ) * 100000 , 10 ) ;
16
+ return value + ( / \? / . test ( value ) ? "&" : "?" ) + new Date ( ) . getTime ( ) + "" +
17
+ parseInt ( Math . random ( ) * 100000 , 10 ) ;
17
18
}
18
19
19
20
reset = QUnit . reset ;
20
21
QUnit . reset = function ( ) {
22
+
21
23
// Ensure jQuery events and data on the fixture are properly removed
22
- jQuery ( "#qunit-fixture" ) . empty ( ) ;
24
+ jQuery ( "#qunit-fixture" ) . empty ( ) ;
25
+
23
26
// Let QUnit reset the fixture
24
27
reset . apply ( this , arguments ) ;
25
28
} ;
@@ -54,7 +57,7 @@ TestHelpers.loadResources = QUnit.urlParams.min ?
54
57
QUnit . config . urlConfig . push ( {
55
58
id : "nojshint" ,
56
59
label : "Skip JSHint" ,
57
- tooltip : "Skip running JSHint, e.g. within TestSwarm, where Jenkins runs it already"
60
+ tooltip : "Skip running JSHint, e.g., within TestSwarm, where Jenkins runs it already"
58
61
} ) ;
59
62
60
63
QUnit . config . urlConfig . push ( {
@@ -70,6 +73,7 @@ QUnit.config.urlConfig.push({
70
73
71
74
jshintLoaded = false ;
72
75
TestHelpers . testJshint = function ( module ) {
76
+
73
77
// Function.prototype.bind check is needed because JSHint doesn't work in ES3 browsers anymore
74
78
// https://github.com/jshint/jshint/issues/1384
75
79
if ( QUnit . urlParams . nojshint || ! Function . prototype . bind ) {
@@ -86,11 +90,11 @@ TestHelpers.testJshint = function( module ) {
86
90
87
91
$ . when (
88
92
$ . ajax ( {
89
- url : url ( "../../../ui/.jshintrc" ) ,
93
+ url : url ( "../../../ui/.jshintrc" ) ,
90
94
dataType : "json"
91
95
} ) ,
92
96
$ . ajax ( {
93
- url : url ( "../../../ui/" + module + ".js" ) ,
97
+ url : url ( "../../../ui/" + module + ".js" ) ,
94
98
dataType : "text"
95
99
} )
96
100
) . done ( function ( hintArgs , srcArgs ) {
@@ -102,6 +106,7 @@ TestHelpers.testJshint = function( module ) {
102
106
delete jshintrc . globals ;
103
107
passed = JSHINT ( source , jshintrc , globals ) ;
104
108
errors = $ . map ( JSHINT . errors , function ( error ) {
109
+
105
110
// JSHINT may report null if there are too many errors
106
111
if ( ! error ) {
107
112
return ;
@@ -123,7 +128,7 @@ TestHelpers.testJshint = function( module ) {
123
128
function testWidgetDefaults ( widget , defaults ) {
124
129
var pluginDefaults = $ . ui [ widget ] . prototype . options ;
125
130
126
- // ensure that all defaults have the correct value
131
+ // Ensure that all defaults have the correct value
127
132
test ( "defined defaults" , function ( ) {
128
133
var count = 0 ;
129
134
$ . each ( defaults , function ( key , val ) {
@@ -136,7 +141,7 @@ function testWidgetDefaults( widget, defaults ) {
136
141
} ) ;
137
142
} ) ;
138
143
139
- // ensure that all defaults were tested
144
+ // Ensure that all defaults were tested
140
145
test ( "tested defaults" , function ( ) {
141
146
var count = 0 ;
142
147
$ . each ( pluginDefaults , function ( key ) {
@@ -174,6 +179,7 @@ function testBasicUsage( widget ) {
174
179
$ ( defaultElement ) [ widget ] ( ) . remove ( ) ;
175
180
ok ( true , "initialized on disconnected DOMElement - never connected" ) ;
176
181
182
+ // Ensure manipulating removed elements works (#3664)
177
183
$ ( defaultElement ) . appendTo ( "body" ) . remove ( ) [ widget ] ( ) . remove ( ) ;
178
184
ok ( true , "initialized on disconnected DOMElement - removed" ) ;
179
185
} ) ;
@@ -192,9 +198,9 @@ TestHelpers.commonWidgetTests = function( widget, settings ) {
192
198
} ) ;
193
199
} ;
194
200
195
- TestHelpers . onFocus = function ( element , onFocus ) {
196
- var fn = function ( event ) {
197
- if ( ! event . originalEvent ) {
201
+ TestHelpers . onFocus = function ( element , onFocus ) {
202
+ var fn = function ( event ) {
203
+ if ( ! event . originalEvent ) {
198
204
return ;
199
205
}
200
206
element . unbind ( "focus" , fn ) ;
@@ -205,6 +211,7 @@ TestHelpers.onFocus= function( element, onFocus ) {
205
211
} ;
206
212
207
213
TestHelpers . forceScrollableWindow = function ( appendTo ) {
214
+
208
215
// The main testable area is 10000x10000 so to enforce scrolling,
209
216
// this DIV must be greater than 10000 to work
210
217
return $ ( "<div>" ) . css ( {
@@ -213,19 +220,17 @@ TestHelpers.forceScrollableWindow = function( appendTo ) {
213
220
} ) . appendTo ( appendTo || "#qunit-fixture" ) ;
214
221
} ;
215
222
216
- /*
217
- * Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
218
- */
223
+ // Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
219
224
window . closeEnough = function ( actual , expected , maxDifference , message ) {
220
- var passes = ( actual === expected ) || Math . abs ( actual - expected ) <= maxDifference ;
221
- QUnit . push ( passes , actual , expected , message ) ;
225
+ var passes = ( actual === expected ) || Math . abs ( actual - expected ) <= maxDifference ;
226
+ QUnit . push ( passes , actual , expected , message ) ;
222
227
} ;
223
228
224
229
/*
225
230
* Experimental assertion for comparing DOM objects.
226
231
*
227
- * Serializes an element and some properties and attributes and its children if any, otherwise the text.
228
- * Then compares the result using deepEqual.
232
+ * Serializes an element and some properties and attributes and its children if any,
233
+ * otherwise the text. Then compares the result using deepEqual() .
229
234
*/
230
235
window . domEqual = function ( selector , modifier , message ) {
231
236
var expected , actual ,
@@ -272,6 +277,7 @@ window.domEqual = function( selector, modifier, message ) {
272
277
styles [ $ . camelCase ( key ) ] = style [ key ] ;
273
278
}
274
279
}
280
+
275
281
// support: Opera, IE <9
276
282
} else {
277
283
for ( key in style ) {
0 commit comments