Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modified test for wrap(String), added test for toggle(fn, fn)
  • Loading branch information
jzaefferer committed Sep 7, 2006
1 parent acf1022 commit eff5688
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/event/event.js
Expand Up @@ -15,6 +15,13 @@ jQuery.fn.extend({
* },function(){
* $(this).removeClass("selected");
* });
*
* var count = 0;
* var fn1 = function() { count++; }
* var fn2 = function() { count--; }
* var link = $('#mark');
* link.click().toggle(fn1, fn2).click().click().click().click().click();
* ok( count == 1, "Check for toggle(fn, fn)" );
*
* @name toggle
* @type jQuery
Expand Down
9 changes: 7 additions & 2 deletions src/jquery/jquery.js
Expand Up @@ -575,11 +575,16 @@ jQuery.fn = jQuery.prototype = {
* @example $("p").wrap("<div class='wrap'></div>");
* @before <p>Test Paragraph.</p>
* @result <div class='wrap'><p>Test Paragraph.</p></div>
*
* @test var defaultText = 'Try them out:'
* var result = $('#first').wrap('<div class="red"><span></span></div>').text();
* ok( defaultText == result, 'Check for simple wrapping' );
* ok( $('#first').parent().parent().is('.red'), 'Check if wrapper div has class "red"' );
*
* @test var defaultText = 'Try them out:'
* @test var result = $('#first').wrap('<div class="red">xx<span></span>yy</div>').text()
* var result = $('#first').wrap('<div class="red">xx<span></span>yy</div>').text()
* ok( 'xx' + defaultText + 'yy' == result, 'Check for wrapping' );
* @test ok( $('#first').parent().parent().is('.red'), 'Check if wrapper div has class "red"' );
* ok( $('#first').parent().parent().is('.red'), 'Check if wrapper div has class "red"' );
*
* @name wrap
* @type jQuery
Expand Down

0 comments on commit eff5688

Please sign in to comment.