33var amdDefined , fireNative ,
44 originaljQuery = this . jQuery || "jQuery" ,
55 original$ = this . $ || "$" ,
6- hasPHP = true ,
7- isLocal = window . location . protocol === "file:" ,
86 // see RFC 2606
97 externalHost = "example.com" ;
108
9+ this . hasPHP = true ;
10+ this . isLocal = window . location . protocol === "file:" ;
11+
1112// For testing .noConflict()
1213this . jQuery = originaljQuery ;
1314this . $ = original$ ;
@@ -26,15 +27,15 @@ define.amd = {};
2627 * @example q("main", "foo", "bar")
2728 * @result [<div id="main">, <span id="foo">, <input id="bar">]
2829 */
29- function q ( ) {
30+ this . q = function ( ) {
3031 var r = [ ] ,
3132 i = 0 ;
3233
3334 for ( ; i < arguments . length ; i ++ ) {
3435 r . push ( document . getElementById ( arguments [ i ] ) ) ;
3536 }
3637 return r ;
37- }
38+ } ;
3839
3940/**
4041 * Asserts that a select matches the given IDs
@@ -44,7 +45,7 @@ function q() {
4445 * @example t("Check for something", "//[a]", ["foo", "baar"]);
4546 * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
4647 */
47- function t ( a , b , c ) {
48+ this . t = function ( a , b , c ) {
4849 var f = jQuery ( b ) . get ( ) ,
4950 s = "" ,
5051 i = 0 ;
@@ -54,9 +55,9 @@ function t( a, b, c ) {
5455 }
5556
5657 deepEqual ( f , q . apply ( q , c ) , a + " (" + b + ")" ) ;
57- }
58+ } ;
5859
59- function createDashboardXML ( ) {
60+ this . createDashboardXML = function ( ) {
6061 var string = '<?xml version="1.0" encoding="UTF-8"?> \
6162 <dashboard> \
6263 <locations class="foo"> \
@@ -70,9 +71,9 @@ function createDashboardXML() {
7071 </dashboard>' ;
7172
7273 return jQuery . parseXML ( string ) ;
73- }
74+ } ;
7475
75- function createWithFriesXML ( ) {
76+ this . createWithFriesXML = function ( ) {
7677 var string = '<?xml version="1.0" encoding="UTF-8"?> \
7778 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \
7879 xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
@@ -100,9 +101,9 @@ function createWithFriesXML() {
100101 </soap:Envelope>' ;
101102
102103 return jQuery . parseXML ( string . replace ( / \{ \{ \s * e x t e r n a l H o s t \s * \} \} / g, externalHost ) ) ;
103- }
104+ } ;
104105
105- function createXMLFragment ( ) {
106+ this . createXMLFragment = function ( ) {
106107 var xml , frag ;
107108 if ( window . ActiveXObject ) {
108109 xml = new ActiveXObject ( "msxml2.domdocument" ) ;
@@ -115,7 +116,7 @@ function createXMLFragment() {
115116 }
116117
117118 return frag ;
118- }
119+ } ;
119120
120121fireNative = document . createEvent ?
121122 function ( node , type ) {
@@ -142,7 +143,7 @@ function url( value ) {
142143}
143144
144145// Ajax testing helper
145- function ajaxTest ( title , expect , options ) {
146+ this . ajaxTest = function ( title , expect , options ) {
146147 var requestOptions ;
147148 if ( jQuery . isFunction ( options ) ) {
148149 options = options ( ) ;
@@ -205,63 +206,59 @@ function ajaxTest( title, expect, options ) {
205206 }
206207 } ;
207208 } ) ;
208- }
209+ } ;
209210
210- ( function ( ) {
211-
212- this . testIframe = function ( fileName , name , fn ) {
213-
214- test ( name , function ( ) {
215- // pause execution for now
216- stop ( ) ;
217-
218- // load fixture in iframe
219- var iframe = loadFixture ( ) ,
220- win = iframe . contentWindow ,
221- interval = setInterval ( function ( ) {
222- if ( win && win . jQuery && win . jQuery . isReady ) {
223- clearInterval ( interval ) ;
224- // continue
225- start ( ) ;
226- // call actual tests passing the correct jQuery instance to use
227- fn . call ( this , win . jQuery , win , win . document ) ;
228- document . body . removeChild ( iframe ) ;
229- iframe = null ;
230- }
231- } , 15 ) ;
232- } ) ;
233-
234- function loadFixture ( ) {
235- var src = url ( "./data/" + fileName + ".html" ) ,
236- iframe = jQuery ( "<iframe />" ) . appendTo ( "body" ) [ 0 ] ;
237- iframe . style . cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;" ;
238- iframe . contentWindow . location = src ;
239- return iframe ;
240- }
241- } ;
242211
243- this . testIframeWithCallback = function ( title , fileName , func ) {
212+ this . testIframe = function ( fileName , name , fn ) {
244213
245- test ( title , function ( ) {
246- var iframe ;
214+ test ( name , function ( ) {
215+ // pause execution for now
216+ stop ( ) ;
247217
248- stop ( ) ;
249- window . iframeCallback = function ( ) {
250- var self = this ,
251- args = arguments ;
252- setTimeout ( function ( ) {
253- window . iframeCallback = undefined ;
254- iframe . remove ( ) ;
255- func . apply ( self , args ) ;
256- func = function ( ) { } ;
218+ // load fixture in iframe
219+ var iframe = loadFixture ( ) ,
220+ win = iframe . contentWindow ,
221+ interval = setInterval ( function ( ) {
222+ if ( win && win . jQuery && win . jQuery . isReady ) {
223+ clearInterval ( interval ) ;
224+ // continue
257225 start ( ) ;
258- } , 0 ) ;
259- } ;
260- iframe = jQuery ( "<div/>" ) . append (
261- jQuery ( "< iframe/>" ) . attr ( "src" , url ( "./data/" + fileName ) )
262- ) . appendTo ( "body" ) ;
263- } ) ;
264- } ;
226+ // call actual tests passing the correct jQuery instance to use
227+ fn . call ( this , win . jQuery , win , win . document ) ;
228+ document . body . removeChild ( iframe ) ;
229+ iframe = null ;
230+ }
231+ } , 15 ) ;
232+ } ) ;
265233
266- window . iframeCallback = undefined ;
267- } ( ) ) ;
234+ function loadFixture ( ) {
235+ var src = url ( "./data/" + fileName + ".html" ) ,
236+ iframe = jQuery ( "<iframe />" ) . appendTo ( "body" ) [ 0 ] ;
237+ iframe . style . cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;" ;
238+ iframe . contentWindow . location = src ;
239+ return iframe ;
240+ }
241+ } ;
242+
243+ this . testIframeWithCallback = function ( title , fileName , func ) {
244+
245+ test ( title , function ( ) {
246+ var iframe ;
247+
248+ stop ( ) ;
249+ window . iframeCallback = function ( ) {
250+ var self = this ,
251+ args = arguments ;
252+ setTimeout ( function ( ) {
253+ window . iframeCallback = undefined ;
254+ iframe . remove ( ) ;
255+ func . apply ( self , args ) ;
256+ func = function ( ) { } ;
257+ start ( ) ;
258+ } , 0 ) ;
259+ } ;
260+ iframe = jQuery ( "<div/>" ) . append (
261+ jQuery ( "<iframe/>" ) . attr ( "src" , url ( "./data/" + fileName ) )
262+ ) . appendTo ( "body" ) ;
263+ } ) ;
264+ } ;
0 commit comments