1
1
2
- module ( "core" ) ;
2
+ QUnit . module ( "core" ) ;
3
3
4
- test ( "jQuery.migrateVersion" , function ( assert ) {
4
+ QUnit . test ( "jQuery.migrateVersion" , function ( assert ) {
5
5
assert . expect ( 1 ) ;
6
6
7
7
assert . ok ( / ^ \d + \. \d + \. [ \w \- ] + / . test ( jQuery . migrateVersion ) , "Version property" ) ;
8
8
} ) ;
9
9
10
- test ( "jQuery(html, props)" , function ( ) {
11
- expect ( 3 ) ;
10
+ QUnit . test ( "jQuery(html, props)" , function ( assert ) {
11
+ assert . expect ( 3 ) ;
12
12
13
13
var $el = jQuery ( "<input/>" , { name : "name" , val : "value" , size : 42 } ) ;
14
14
15
- equal ( $el . attr ( "name" ) , "name" , "Name attribute" ) ;
16
- equal ( $el . attr ( "size" ) ,
15
+ assert . equal ( $el . attr ( "name" ) , "name" , "Name attribute" ) ;
16
+ assert . equal ( $el . attr ( "size" ) ,
17
17
jQuery . isEmptyObject ( jQuery . attrFn ) ? undefined : "42" , "Size attribute" ) ;
18
- equal ( $el . val ( ) , "value" , "Call setter method" ) ;
18
+ assert . equal ( $el . val ( ) , "value" , "Call setter method" ) ;
19
19
} ) ;
20
20
21
- test ( "jQuery( '#' )" , function ( ) {
22
- expect ( 2 ) ;
21
+ QUnit . test ( "jQuery( '#' )" , function ( assert ) {
22
+ assert . expect ( 2 ) ;
23
23
24
- expectWarning ( "Selector, through the jQuery constructor, nothing but hash" , function ( ) {
24
+ expectWarning ( assert , "Selector, through the jQuery constructor, nothing but hash" , function ( ) {
25
25
var set = jQuery ( "#" ) ;
26
- equal ( set . length , 0 , "empty set" ) ;
26
+ assert . equal ( set . length , 0 , "empty set" ) ;
27
27
} ) ;
28
28
} ) ;
29
29
30
30
QUnit . test ( "Attribute selectors with unquoted hashes" , function ( assert ) {
31
- expect ( 31 ) ;
31
+ assert . expect ( 31 ) ;
32
32
33
33
var markup = jQuery (
34
34
"<div>" +
@@ -73,28 +73,28 @@ QUnit.test( "Attribute selectors with unquoted hashes", function( assert ) {
73
73
"a[href=space#junk]:eq(1)"
74
74
] ;
75
75
76
- expectNoWarning ( "Perfectly cromulent selectors are unchanged" , function ( ) {
76
+ expectNoWarning ( assert , "Perfectly cromulent selectors are unchanged" , function ( ) {
77
77
okays . forEach ( function ( okay ) {
78
78
assert . equal ( jQuery ( okay , markup ) . length , 1 , okay ) ;
79
79
assert . equal ( markup . find ( okay ) . length , 1 , okay ) ;
80
80
} ) ;
81
81
} ) ;
82
82
83
- expectWarning ( "Values with unquoted hashes are quoted" , fixables . length , function ( ) {
83
+ expectWarning ( assert , "Values with unquoted hashes are quoted" , fixables . length , function ( ) {
84
84
fixables . forEach ( function ( fixable ) {
85
85
assert . equal ( jQuery ( fixable , markup ) . length , 1 , fixable ) ;
86
86
assert . equal ( markup . find ( fixable ) . length , 1 , fixable ) ;
87
87
} ) ;
88
88
} ) ;
89
89
90
- expectWarning ( "False positives" , positives . length , function ( ) {
90
+ expectWarning ( assert , "False positives" , positives . length , function ( ) {
91
91
positives . forEach ( function ( positive ) {
92
92
assert . equal ( jQuery ( positive , markup ) . length , 1 , positive ) ;
93
93
assert . equal ( markup . find ( positive ) . length , 1 , positive ) ;
94
94
} ) ;
95
95
} ) ;
96
96
97
- expectWarning ( "Unfixable cases" , failures . length , function ( ) {
97
+ expectWarning ( assert , "Unfixable cases" , failures . length , function ( ) {
98
98
failures . forEach ( function ( failure ) {
99
99
try {
100
100
jQuery ( failure , markup ) ;
@@ -108,7 +108,7 @@ QUnit.test( "Attribute selectors with unquoted hashes", function( assert ) {
108
108
} ) ;
109
109
110
110
// Ensure we don't process jQuery( x ) when x is a function
111
- expectNoWarning ( "ready function with attribute selector" , function ( ) {
111
+ expectNoWarning ( assert , "ready function with attribute selector" , function ( ) {
112
112
try {
113
113
jQuery ( function ( ) {
114
114
if ( jQuery . thisIsNeverTrue ) {
@@ -119,7 +119,7 @@ QUnit.test( "Attribute selectors with unquoted hashes", function( assert ) {
119
119
} ) ;
120
120
} ) ;
121
121
122
- test ( "XSS injection (leading hash)" , function ( assert ) {
122
+ QUnit . test ( "XSS injection (leading hash)" , function ( assert ) {
123
123
assert . expect ( 1 ) ;
124
124
125
125
var threw = false ;
@@ -133,7 +133,7 @@ test( "XSS injection (leading hash)", function( assert ) {
133
133
assert . equal ( threw , true , "Throw on leading-hash HTML (treated as selector)" ) ;
134
134
} ) ;
135
135
136
- test ( "XSS injection (XSS via script tag)" , function ( assert ) {
136
+ QUnit . test ( "XSS injection (XSS via script tag)" , function ( assert ) {
137
137
assert . expect ( 2 ) ;
138
138
139
139
var threw = false ;
@@ -147,7 +147,7 @@ test( "XSS injection (XSS via script tag)", function( assert ) {
147
147
assert . equal ( window . XSS , false , "XSS" ) ;
148
148
} ) ;
149
149
150
- test ( "XSS injection (XSS with hash and leading space)" , function ( assert ) {
150
+ QUnit . test ( "XSS injection (XSS with hash and leading space)" , function ( assert ) {
151
151
assert . expect ( 2 ) ;
152
152
153
153
var threw = false ;
@@ -161,7 +161,7 @@ test( "XSS injection (XSS with hash and leading space)", function( assert ) {
161
161
assert . equal ( window . XSS , false , "XSS" ) ;
162
162
} ) ;
163
163
164
- test ( "XSS injection (XSS via onerror inline handler)" , function ( assert ) {
164
+ QUnit . test ( "XSS injection (XSS via onerror inline handler)" , function ( assert ) {
165
165
assert . expect ( 2 ) ;
166
166
167
167
var start ,
@@ -182,25 +182,25 @@ test( "XSS injection (XSS via onerror inline handler)", function( assert ) {
182
182
} , 1000 ) ;
183
183
} ) ;
184
184
185
- test ( "jQuery( '<element>' ) usable on detached elements (#128)" , function ( assert ) {
185
+ QUnit . test ( "jQuery( '<element>' ) usable on detached elements (#128)" , function ( assert ) {
186
186
assert . expect ( 1 ) ;
187
187
188
188
jQuery ( "<a>" ) . outerWidth ( ) ;
189
189
assert . ok ( true , "No crash when operating on detached elements with window" ) ;
190
190
} ) ;
191
191
192
- test ( ".size" , function ( assert ) {
192
+ QUnit . test ( ".size" , function ( assert ) {
193
193
assert . expect ( 1 ) ;
194
194
195
- expectWarning ( "size" , function ( ) {
195
+ expectWarning ( assert , "size" , function ( ) {
196
196
jQuery ( "<div />" ) . size ( ) ;
197
197
} ) ;
198
198
} ) ;
199
199
200
- test ( "jQuery.parseJSON" , function ( assert ) {
200
+ QUnit . test ( "jQuery.parseJSON" , function ( assert ) {
201
201
assert . expect ( 2 ) ;
202
202
203
- expectWarning ( "jQuery.parseJSON" , function ( ) {
203
+ expectWarning ( assert , "jQuery.parseJSON" , function ( ) {
204
204
assert . deepEqual (
205
205
jQuery . parseJSON ( "{\"a\":1}" ) ,
206
206
{ a : 1 } ,
@@ -209,7 +209,7 @@ test( "jQuery.parseJSON", function( assert ) {
209
209
} ) ;
210
210
} ) ;
211
211
212
- test ( "jQuery.isNumeric" , function ( assert ) {
212
+ QUnit . test ( "jQuery.isNumeric" , function ( assert ) {
213
213
assert . expect ( 8 ) ;
214
214
215
215
var ToString = function ( value ) {
@@ -218,12 +218,12 @@ test( "jQuery.isNumeric", function( assert ) {
218
218
} ;
219
219
} ;
220
220
221
- expectWarning ( "changed cases" , function ( ) {
221
+ expectWarning ( assert , "changed cases" , function ( ) {
222
222
assert . equal ( jQuery . isNumeric ( new ToString ( "42" ) ) , true ,
223
223
"Custom .toString returning number" ) ;
224
224
} ) ;
225
225
226
- expectNoWarning ( "unchanged cases" , function ( ) {
226
+ expectNoWarning ( assert , "unchanged cases" , function ( ) {
227
227
assert . equal ( jQuery . isNumeric ( 42 ) , true , "number" ) ;
228
228
assert . equal ( jQuery . isNumeric ( "42" ) , true , "number string" ) ;
229
229
assert . equal ( jQuery . isNumeric ( "devo" ) , false , "non-numeric string" ) ;
@@ -233,10 +233,10 @@ test( "jQuery.isNumeric", function( assert ) {
233
233
} ) ;
234
234
} ) ;
235
235
236
- test ( "jQuery.unique" , function ( assert ) {
236
+ QUnit . test ( "jQuery.unique" , function ( assert ) {
237
237
assert . expect ( 2 ) ;
238
238
239
- expectWarning ( "jQuery.unique" , function ( ) {
239
+ expectWarning ( assert , "jQuery.unique" , function ( ) {
240
240
var body = jQuery ( "body" ) [ 0 ] ,
241
241
head = jQuery ( "head" ) [ 0 ] ;
242
242
assert . deepEqual (
@@ -246,22 +246,22 @@ test( "jQuery.unique", function( assert ) {
246
246
} ) ;
247
247
} ) ;
248
248
249
- test ( "jQuery.expr.pseudos aliases" , function ( assert ) {
249
+ QUnit . test ( "jQuery.expr.pseudos aliases" , function ( assert ) {
250
250
assert . expect ( 7 ) ;
251
251
252
- expectWarning ( "jQuery.expr.filters" , function ( ) {
252
+ expectWarning ( assert , "jQuery.expr.filters" , function ( ) {
253
253
jQuery . expr . filters . mazda = function ( elem ) {
254
254
return elem . style . zoom === "3" ;
255
255
} ;
256
256
} ) ;
257
257
258
- expectWarning ( "jQuery.expr[':']" , function ( ) {
258
+ expectWarning ( assert , "jQuery.expr[':']" , function ( ) {
259
259
jQuery . expr [ ":" ] . marginal = function ( elem ) {
260
260
return parseInt ( elem . style . marginLeftWidth ) > 20 ;
261
261
} ;
262
262
} ) ;
263
263
264
- expectNoWarning ( "jQuery.expr.pseudos" , function ( ) {
264
+ expectNoWarning ( assert , "jQuery.expr.pseudos" , function ( ) {
265
265
var fixture = jQuery ( "#qunit-fixture" ) . prepend ( "<p>hello</p>" ) ;
266
266
267
267
assert . ok ( jQuery . expr . pseudos . mazda , "filters assigned" ) ;
@@ -278,7 +278,7 @@ test( "jQuery.expr.pseudos aliases", function( assert ) {
278
278
QUnit . test ( "jQuery.holdReady (warn only)" , function ( assert ) {
279
279
assert . expect ( 1 ) ;
280
280
281
- expectWarning ( "jQuery.holdReady" , 1 , function ( ) {
281
+ expectWarning ( assert , "jQuery.holdReady" , 1 , function ( ) {
282
282
jQuery . holdReady ( true ) ;
283
283
jQuery . holdReady ( false ) ;
284
284
} ) ;
0 commit comments