diff options
author | timmywil <timmywillisn@gmail.com> | 2012-05-29 12:40:13 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2012-05-29 13:13:26 -0400 |
commit | a8d9d05388465b16880be43629af008ff19b7725 (patch) | |
tree | d917fe6deeb8678aeba38ccd1e9117cff07c808f /test/unit | |
parent | 02dd7c570bf4dbbdfc168f4352d04c667447be5d (diff) | |
download | jquery-a8d9d05388465b16880be43629af008ff19b7725.tar.gz jquery-a8d9d05388465b16880be43629af008ff19b7725.zip |
Add quick-start documentation for testing with QUnit and using jQuery's helper methods.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/attributes.js | 15 | ||||
-rw-r--r-- | test/unit/dimensions.js | 12 | ||||
-rw-r--r-- | test/unit/effects.js | 2 | ||||
-rw-r--r-- | test/unit/manipulation.js | 12 | ||||
-rw-r--r-- | test/unit/queue.js | 6 | ||||
-rw-r--r-- | test/unit/selector.js | 7 |
6 files changed, 44 insertions, 10 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index a39712f34..8f21303f3 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1,8 +1,19 @@ module("attributes", { teardown: moduleTeardown }); -var bareObj = function(value) { return value; }; -var functionReturningObj = function(value) { return (function() { return value; }); }; +var bareObj = function( value ) { return value; }; +var functionReturningObj = function( value ) { return (function() { return value; }); }; +/* + ======== local reference ======= + bareObj and functionReturningObj can be used to test passing functions to setters + See testVal below for an example + + bareObj( value ); + This function returns whatever value is passed in + + functionReturningObj( value ); + Returns a function that returns the value +*/ test("jQuery.propFix integrity test", function() { expect(1); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 0b4eedcbf..e2cf6c003 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -8,6 +8,18 @@ function fn( val ) { return function(){ return val; }; } +/* + ======== local reference ======= + pass and fn can be used to test passing functions to setters + See testWidth below for an example + + pass( value ); + This function returns whatever value is passed in + + fn( value ); + Returns a function that returns the value +*/ + function testWidth( val ) { expect(9); diff --git a/test/unit/effects.js b/test/unit/effects.js index 2b1cff3d3..e952ca8a9 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1628,4 +1628,4 @@ asyncTest( "multiple unqueued and promise", 4, function() { }); }); -} // if ( jQuery.fx )
\ No newline at end of file +} // if ( jQuery.fx ) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 672b204e1..a6f418522 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -6,6 +6,18 @@ Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; +/* + ======== local reference ======= + bareObj and functionReturningObj can be used to test passing functions to setters + See testVal below for an example + + bareObj( value ); + This function returns whatever value is passed in + + functionReturningObj( value ); + Returns a function that returns the value +*/ + test("text()", function() { expect(5); var expected = "This link has class=\"blog\": Simon Willison's Weblog"; diff --git a/test/unit/queue.js b/test/unit/queue.js index fac74f906..540a41b59 100644 --- a/test/unit/queue.js +++ b/test/unit/queue.js @@ -1,6 +1,4 @@ -module( "queue", { - teardown: moduleTeardown -}); +module( "queue", { teardown: moduleTeardown }); test( "queue() with other types", 12, function() { var counter = 0; @@ -288,4 +286,4 @@ if ( jQuery.fn.stop ) { foo.stop( false, true ); }); -} // if ( jQuery.fn.stop )
\ No newline at end of file +} // if ( jQuery.fn.stop ) diff --git a/test/unit/selector.js b/test/unit/selector.js index d605ab8df..079d130cc 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -1,9 +1,9 @@ +module("selector - jQuery only", { teardown: moduleTeardown }); + /** * This test page is for selector tests that require jQuery in order to do the selection */ -module("selector - jQuery only", { teardown: moduleTeardown }); - test("element - jQuery only", function() { expect( 7 ); @@ -65,7 +65,8 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue expect(35); /** - * Returns an array of elements with the given IDs, eg. + * Returns an array of elements with the given IDs + * q & t are added here for the iFrame's context */ function q() { var r = [], |