http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89999
Revision: 89999
Author: neilk
Date: 2011-06-13 19:20:36 +0000 (Mon, 13 Jun 2011)
Log Message:
-----------
renamed "timeline" test cases, which are now called "ready" events. Added tests
for purge functions
Modified Paths:
--------------
trunk/extensions/UploadWizard/test/jasmine/spec/mw.pubsub.spec.js
Modified: trunk/extensions/UploadWizard/test/jasmine/spec/mw.pubsub.spec.js
===================================================================
--- trunk/extensions/UploadWizard/test/jasmine/spec/mw.pubsub.spec.js
2011-06-13 19:08:41 UTC (rev 89998)
+++ trunk/extensions/UploadWizard/test/jasmine/spec/mw.pubsub.spec.js
2011-06-13 19:20:36 UTC (rev 89999)
@@ -26,27 +26,66 @@
expect( result2 ).toBe( sub1data );
} );
- it( "should allow timeline subscription with publishing after
subscription", function() {
+ it( "should allow ready subscription with publishing after
subscription", function() {
var sub2data = [ 'quux', 'pif' ];
var result;
- $.subscribeTimeline( 'sub2', function( arg ) {
+ $.subscribeReady( 'sub2', function( arg ) {
result = arg;
} );
- $.publishTimeline( 'sub2', sub2data );
+ $.publishReady( 'sub2', sub2data );
expect( result ).toBe( sub2data );
} );
- it( "should allow timeline subscription with subscription after
publishing", function() {
+ it( "should allow ready subscription with subscription after
publishing", function() {
var sub3data = [ 'paf', 'klortho' ];
var result;
- $.publishTimeline( 'sub3', sub3data );
- $.subscribeTimeline( 'sub3', function( arg ) {
+ $.publishReady( 'sub3', sub3data );
+ $.subscribeReady( 'sub3', function( arg ) {
result = arg;
} );
expect( result ).toBe( sub3data );
} );
+ it( "should not allow a ready event to happen twice",
function() {
+ var first = [ 'paf' ];
+ var second = [ 'glom' ];
+ var result;
+ $.publishReady( 'sub4', first );
+ $.publishReady( 'sub4', second );
+ $.subscribeReady( 'sub4', function( arg ) {
+ result = arg;
+ } );
+ expect( result ).toBe( first );
+ } );
+
+ it( "should purge subscriptions", function() {
+ var data = [ 'paf' ];
+ var result1, result2;
+ $.subscribeReady( 'sub5', function( arg ) {
+ result1 = arg;
+ } );
+ $.purgeSubscriptions();
+ $.subscribeReady( 'sub5', function( arg ) {
+ result2 = arg;
+ } );
+ $.publishReady( 'sub5', data );
+ expect( result1 ).not.toBeDefined();
+ expect( result2 ).toBe( data );
+ } );
+
+ it( "should purge ready events", function() {
+ var data1 = [ 'paf' ];
+ var data2 = [ 'paf' ];
+ $.publishReady( 'sub6', data1 );
+ $.purgeReadyEvents();
+ $.publishReady( 'sub6', data2 );
+ $.subscribeReady( 'sub6', function( arg ) {
+ result = arg;
+ } );
+ expect( result ).toBe( data2 );
+ } );
+
} );
} )( mediaWiki, jQuery );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs