Add test to validate special page aliases
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.delayedBind.test.js
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;
8
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 } );
14
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 } );
21
22 QUnit.asyncTest( 'jquery.delayedBind without data option', 1, function ( assert ) {
23 var $fixture = $( '<div>' ).appendTo( '#qunit-fixture' ),
24 delay = 50;
25
26 $fixture.delayedBind( delay, 'testevent', function () {
27 assert.ok( true, 'testevent fired' );
28 QUnit.start();
29 } );
30
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 ) );