diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2016-04-08 12:00:17 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2016-04-11 13:29:11 -0400 |
commit | 08d73d7f9c7eec2f0abd14d00bf903625728ef17 (patch) | |
tree | a6cfec625dfcde55eed1d88eebd0164356dbcb52 /README.md | |
parent | 755e7ccf018eb150eddefe78063a9ec58b3229e3 (diff) | |
download | jquery-08d73d7f9c7eec2f0abd14d00bf903625728ef17.tar.gz jquery-08d73d7f9c7eec2f0abd14d00bf903625728ef17.zip |
Tests: Make iframe tests wait after checking isReady
Ref gh-3040
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 33 |
1 files changed, 13 insertions, 20 deletions
@@ -340,32 +340,25 @@ url("data/test.php?foo=bar"); ``` -### Load tests in an iframe ### - -Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"` -and fires the given callback on jQuery ready (using the jQuery loading from that page) -and passes the iFrame's jQuery to the callback. - -```js -testIframe( fileName, testName, callback ); -``` - -Callback arguments: +### Load tests in an iframe (window.iframeCallback) ### ```js -callback( jQueryFromIFrame, iFrameWindow, iFrameDocument ); +testIframeWithCallback( testName, fileName, + function callback( arg1, arg2, ... assert ) { + ... + } ); ``` -### Load tests in an iframe (window.iframeCallback) ### - Loads a given page constructing a url with fileName: `"./data/" + fileName + ".html"` -The given callback is fired when window.iframeCallback is called by the page. -The arguments passed to the callback are the same as the -arguments passed to window.iframeCallback, whatever that may be. +The iframe page is responsible for determining when `window.parent.iframeCallback` +should be called, for example at document ready or window.onload time. +Arguments passed to the callback are the same as the arguments passed +to `window.parent.iframeCallback` by the iframe, plus the QUnit `assert` +object from the `QUnit.test()` that this wrapper sets up for you. +The iframe should send any objects needed by the unit test via arguments, for example +its `jQuery`, `window`, and `document` objects from the iframe. + -```js -testIframeWithCallback( testName, fileName, callback ); -``` Questions? ---------- |