Index: branches/REL1_18/phase3/tests/qunit/index.html |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | <script src="../../resources/jquery/jquery.byteLength.js"></script> |
45 | 45 | <script src="../../resources/jquery/jquery.byteLimit.js"></script> |
46 | 46 | <script src="../../resources/jquery/jquery.colorUtil.js"></script> |
| 47 | + <script src="../../resources/jquery/jquery.delayedBind.js"></script> |
47 | 48 | <script src="../../resources/jquery/jquery.getAttrs.js"></script> |
48 | 49 | <script src="../../resources/jquery/jquery.localize.js"></script> |
49 | 50 | <script src="../../resources/jquery/jquery.tabIndex.js"></script> |
— | — | @@ -69,6 +70,7 @@ |
70 | 71 | <script src="suites/resources/jquery/jquery.byteLength.js"></script> |
71 | 72 | <script src="suites/resources/jquery/jquery.byteLimit.js"></script> |
72 | 73 | <script src="suites/resources/jquery/jquery.colorUtil.js"></script> |
| 74 | + <script src="suites/resources/jquery/jquery.delayedBind.test.js"></script> |
73 | 75 | <script src="suites/resources/jquery/jquery.getAttrs.js"></script> |
74 | 76 | <script src="suites/resources/jquery/jquery.localize.js"></script> |
75 | 77 | <script src="suites/resources/jquery/jquery.tabIndex.js"></script> |
Index: branches/REL1_18/phase3/tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +test('jquery.delayedBind with data option', function() { |
| 3 | + var $fixture = $('<div>').appendTo('body'), |
| 4 | + data = { magic: "beeswax" }, |
| 5 | + delay = 50; |
| 6 | + |
| 7 | + $fixture.delayedBind(delay, 'testevent', data, function(event) { |
| 8 | + start(); // continue! |
| 9 | + ok(true, 'testevent fired'); |
| 10 | + ok(event.data === data, 'data is passed through delayedBind'); |
| 11 | + }); |
| 12 | + |
| 13 | + expect(2); |
| 14 | + stop(); // async! |
| 15 | + |
| 16 | + // We'll trigger it thrice, but it should only happen once. |
| 17 | + $fixture.trigger('testevent', {}); |
| 18 | + $fixture.trigger('testevent', {}); |
| 19 | + $fixture.trigger('testevent', {}); |
| 20 | + $fixture.trigger('testevent', {}); |
| 21 | +}); |
| 22 | + |
| 23 | +test('jquery.delayedBind without data option', function() { |
| 24 | + var $fixture = $('<div>').appendTo('body'), |
| 25 | + data = { magic: "beeswax" }, |
| 26 | + delay = 50; |
| 27 | + |
| 28 | + $fixture.delayedBind(delay, 'testevent', function(event) { |
| 29 | + start(); // continue! |
| 30 | + ok(true, 'testevent fired'); |
| 31 | + }); |
| 32 | + |
| 33 | + expect(1); |
| 34 | + stop(); // async! |
| 35 | + |
| 36 | + // We'll trigger it thrice, but it should only happen once. |
| 37 | + $fixture.trigger('testevent', {}); |
| 38 | + $fixture.trigger('testevent', {}); |
| 39 | + $fixture.trigger('testevent', {}); |
| 40 | + $fixture.trigger('testevent', {}); |
| 41 | +}); |
| 42 | + |
Property changes on: branches/REL1_18/phase3/tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 43 | + native |
Index: branches/REL1_18/phase3/resources/jquery/jquery.collapsibleTabs.js |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | // if we haven't already bound our resize hanlder, bind it now |
26 | 26 | if( !$.collapsibleTabs.boundEvent ) { |
27 | 27 | $( window ) |
28 | | - .delayedBind( '500', 'resize', null, function( ) { $.collapsibleTabs.handleResize(); } ); |
| 28 | + .delayedBind( '500', 'resize', function( ) { $.collapsibleTabs.handleResize(); } ); |
29 | 29 | } |
30 | 30 | // call our resize handler to setup the page |
31 | 31 | $.collapsibleTabs.handleResize(); |
Index: branches/REL1_18/phase3/resources/jquery/jquery.delayedBind.js |
— | — | @@ -19,6 +19,11 @@ |
20 | 20 | * @param callback Function to call |
21 | 21 | */ |
22 | 22 | delayedBind: function( timeout, event, data, callback ) { |
| 23 | + if ( arguments.length == 3 ) { |
| 24 | + // Shift optional parameter down |
| 25 | + callback = data; |
| 26 | + data = undefined; |
| 27 | + } |
23 | 28 | var encEvent = encodeEvent( event ); |
24 | 29 | return this.each( function() { |
25 | 30 | var that = this; |
Property changes on: branches/REL1_18/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
26 | 31 | Merged /trunk/phase3:r105007 |