summaryrefslogtreecommitdiff
path: root/tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js')
-rw-r--r--tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js
index cdb26244..5329be6a 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.track.test.js
@@ -39,4 +39,22 @@
assert.assertTrue( this.timeStamp >= now, 'thisValue has sane timestamp' );
} );
} );
+
+ QUnit.test( 'trackUnsubscribe', 1, function ( assert ) {
+ var sequence = [];
+ function unsubber( topic, data ) {
+ sequence.push( [ topic, data ] );
+ }
+
+ mw.track( 'unsub', { key: 1 } );
+ mw.trackSubscribe( 'unsub', unsubber );
+ mw.track( 'unsub', { key: 2 } );
+ mw.trackUnsubscribe( unsubber );
+ mw.track( 'unsub', { key: 3 } );
+
+ assert.deepEqual( sequence, [
+ [ 'unsub', { key: 1 } ],
+ [ 'unsub', { key: 2 } ]
+ ], 'Stop when unsubscribing' );
+ } );
}( mediaWiki ) );