@@ -340,24 +340,32 @@ url("data/test.php?foo=bar");
340340```
341341
342342
343- ### Load tests in an iframe (window.iframeCallback) ###
343+ ### Run tests in an iframe ###
344+
345+ Some tests may require a document other than the standard test fixture, and
346+ these can be run in a separate iframe. The actual test code and assertions
347+ remain in jQuery's main test files; only the minimal test fixture markup
348+ and setup code should be placed in the iframe file.
344349
345350``` js
346- testIframeWithCallback ( testName, fileName,
347- function callback ( arg1 , arg2 , ... assert ) {
351+ testIframe ( testName, fileName,
352+ function testCallback (
353+ assert , jQuery , window , document ,
354+ [ additional args ] ) {
348355 ...
349356 } );
350357```
351358
352- Loads a given page constructing a url with fileName: ` "./data/" + fileName + ".html" `
353- The iframe page is responsible for determining when ` window.parent.iframeCallback `
354- should be called, for example at document ready or window.onload time.
355- Arguments passed to the callback are the same as the arguments passed
356- to ` window.parent.iframeCallback ` by the iframe, plus the QUnit ` assert `
357- object from the ` QUnit.test() ` that this wrapper sets up for you.
358- The iframe should send any objects needed by the unit test via arguments, for example
359- its ` jQuery ` , ` window ` , and ` document ` objects from the iframe.
359+ This loads a page, constructing a url with fileName ` "./data/" + fileName ` .
360+ The iframed page determines when the callback occurs in the test by
361+ including the "/test/data/iframeTest.js" script and calling
362+ ` startIframeTest( [ additional args ] ) ` when appropriate. Often this
363+ will be after either document ready or ` window.onload ` fires.
360364
365+ The ` testCallback ` receives the QUnit ` assert ` object created by ` testIframe `
366+ for this test, followed by the global ` jQuery ` , ` window ` , and ` document ` from
367+ the iframe. If the iframe code passes any arguments to ` startIframeTest ` ,
368+ they follow the ` document ` argument.
361369
362370
363371Questions?
0 commit comments