r89999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89998‎ | r89999 | r90000 >
Date:19:20, 13 June 2011
Author:neilk
Status:ok
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/test/jasmine/spec/mw.pubsub.spec.js
@@ -26,27 +26,66 @@
2727 expect( result2 ).toBe( sub1data );
2828 } );
2929
30 - it( "should allow timeline subscription with publishing after subscription", function() {
 30+ it( "should allow ready subscription with publishing after subscription", function() {
3131 var sub2data = [ 'quux', 'pif' ];
3232 var result;
33 - $.subscribeTimeline( 'sub2', function( arg ) {
 33+ $.subscribeReady( 'sub2', function( arg ) {
3434 result = arg;
3535 } );
36 - $.publishTimeline( 'sub2', sub2data );
 36+ $.publishReady( 'sub2', sub2data );
3737 expect( result ).toBe( sub2data );
3838 } );
3939
4040
41 - it( "should allow timeline subscription with subscription after publishing", function() {
 41+ it( "should allow ready subscription with subscription after publishing", function() {
4242 var sub3data = [ 'paf', 'klortho' ];
4343 var result;
44 - $.publishTimeline( 'sub3', sub3data );
45 - $.subscribeTimeline( 'sub3', function( arg ) {
 44+ $.publishReady( 'sub3', sub3data );
 45+ $.subscribeReady( 'sub3', function( arg ) {
4646 result = arg;
4747 } );
4848 expect( result ).toBe( sub3data );
4949 } );
5050
 51+ it( "should not allow a ready event to happen twice", function() {
 52+ var first = [ 'paf' ];
 53+ var second = [ 'glom' ];
 54+ var result;
 55+ $.publishReady( 'sub4', first );
 56+ $.publishReady( 'sub4', second );
 57+ $.subscribeReady( 'sub4', function( arg ) {
 58+ result = arg;
 59+ } );
 60+ expect( result ).toBe( first );
 61+ } );
 62+
 63+ it( "should purge subscriptions", function() {
 64+ var data = [ 'paf' ];
 65+ var result1, result2;
 66+ $.subscribeReady( 'sub5', function( arg ) {
 67+ result1 = arg;
 68+ } );
 69+ $.purgeSubscriptions();
 70+ $.subscribeReady( 'sub5', function( arg ) {
 71+ result2 = arg;
 72+ } );
 73+ $.publishReady( 'sub5', data );
 74+ expect( result1 ).not.toBeDefined();
 75+ expect( result2 ).toBe( data );
 76+ } );
 77+
 78+ it( "should purge ready events", function() {
 79+ var data1 = [ 'paf' ];
 80+ var data2 = [ 'paf' ];
 81+ $.publishReady( 'sub6', data1 );
 82+ $.purgeReadyEvents();
 83+ $.publishReady( 'sub6', data2 );
 84+ $.subscribeReady( 'sub6', function( arg ) {
 85+ result = arg;
 86+ } );
 87+ expect( result ).toBe( data2 );
 88+ } );
 89+
5190 } );
5291
5392 } )( mediaWiki, jQuery );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89913readiness events, that can occur only once, and can be subscribed to even if ...neilk05:13, 12 June 2011
r89916tests for pubsub and units.bytesneilk05:20, 12 June 2011

Status & tagging log