aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2012-05-29 12:40:13 -0400
committertimmywil <timmywillisn@gmail.com>2012-05-29 13:13:26 -0400
commita8d9d05388465b16880be43629af008ff19b7725 (patch)
treed917fe6deeb8678aeba38ccd1e9117cff07c808f /README.md
parent02dd7c570bf4dbbdfc168f4352d04c667447be5d (diff)
downloadjquery-a8d9d05388465b16880be43629af008ff19b7725.tar.gz
jquery-a8d9d05388465b16880be43629af008ff19b7725.zip
Add quick-start documentation for testing with QUnit and using jQuery's helper methods.
Diffstat (limited to 'README.md')
-rw-r--r--README.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/README.md b/README.md
index ad38c228b..3e0cbf185 100644
--- a/README.md
+++ b/README.md
@@ -161,6 +161,60 @@ Following are some commands that can be used there:
* `Ctrl + S` - save
* `Ctrl + Q` - quit
+[QUnit](http://docs.jquery.com/QUnit) Reference
+-----------------
+
+Test methods:
+ expect( numAssertions )
+ stop()
+ start()
+ note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite
+ so that start and stop can be passed as callbacks without worrying about
+ their parameters
+
+Test assertions:
+ ok( value, [message] )
+ equal( actual, expected, [message] )
+ notEqual( actual, expected, [message] )
+ deepEqual( actual, expected, [message] )
+ notDeepEqual( actual, expected, [message] )
+ strictEqual( actual, expected, [message] )
+ notStrictEqual( actual, expected, [message] )
+ raises( block, [expected], [message] )
+
+Test Suite Convenience Methods Reference (See [test/data/testinit.js](https://github.com/jquery/jquery/blob/master/test/data/testinit.js))
+------------------------------
+
+q( ... );
+ Returns an array of elements with the given IDs
+ @example q("main", "foo", "bar") => [<div id="main">, <span id="foo">, <input id="bar">]
+
+t( testName, selector, [ "#array", "#of", "#ids" ] );
+ Asserts that a select matches the given IDs
+ @example t("Check for something", "//[a]", ["foo", "baar"]);
+
+fireNative( node, eventType );
+ Fires a native DOM event without going through jQuery
+ @example fireNative( jQuery("#elem")[0], "click" );
+
+url( "some/url.php" );
+ Add random number to url to stop caching
+ @example url("data/test.html") => "data/test.html?10538358428943"
+ @example url("data/test.php?foo=bar") => "data/test.php?foo=bar&10538358345554"
+
+testIframe( fileName, testName, callback );
+ 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.
+ Callback arguments:
+ callback( jQueryFromIFrame, iFrameWindow, iFrameDocument )
+
+testIframeWithCallback( testName, fileName, callback )
+ 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
+
Questions?
----------