Merge "Add ss_active_users in SiteStats::isSane"
[mediawiki.git] / tests / qunit / suites / resources / jquery / jquery.delayedBind.test.js
blob234b19cbdebe58452c9efc618d2777c8f8e896ec
1 ( function ( $ ) {
2         QUnit.asyncTest( 'jquery.delayedBind with data option', 2, function ( assert ) {
3                 var $fixture = $( '<div>' ).appendTo( '#qunit-fixture' ),
4                         data = {
5                                 magic: 'beeswax'
6                         },
7                         delay = 50;
9                 $fixture.delayedBind( delay, 'testevent', data, function ( e ) {
10                         assert.ok( true, 'testevent fired' );
11                         assert.ok( e.data === data, 'data is passed through delayedBind' );
12                         QUnit.start();
13                 } );
15                 // We'll trigger it thrice, but it should only happen once.
16                 $fixture.trigger( 'testevent', {} );
17                 $fixture.trigger( 'testevent', {} );
18                 $fixture.trigger( 'testevent', {} );
19                 $fixture.trigger( 'testevent', {} );
20         } );
22         QUnit.asyncTest( 'jquery.delayedBind without data option', 1, function ( assert ) {
23                 var $fixture = $( '<div>' ).appendTo( '#qunit-fixture' ),
24                         delay = 50;
26                 $fixture.delayedBind( delay, 'testevent', function () {
27                         assert.ok( true, 'testevent fired' );
28                         QUnit.start();
29                 } );
31                 // We'll trigger it thrice, but it should only happen once.
32                 $fixture.trigger( 'testevent', {} );
33                 $fixture.trigger( 'testevent', {} );
34                 $fixture.trigger( 'testevent', {} );
35                 $fixture.trigger( 'testevent', {} );
36         } );
37 }( jQuery ) );