jenkins-bot has submitted this change and it was merged.

Change subject: test: Add test for passing EventEmitter#connect a function
......................................................................


test: Add test for passing EventEmitter#connect a function

Increasing test coverage.

I'm not sure why this feature exists since passing a function
here basically just does a regular .on() binding. The given
function has no relation to the host object passed to connect().

But we currently support it, so might as well test it.

Change-Id: I805dd75611cca407f43fce86d0521df4307e26d0
---
M test/unit/EventEmitter.test.js
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/test/unit/EventEmitter.test.js b/test/unit/EventEmitter.test.js
index 361b857..0e485f4 100644
--- a/test/unit/EventEmitter.test.js
+++ b/test/unit/EventEmitter.test.js
@@ -140,7 +140,7 @@
                assert.ok( true, 'Unbinding an unknown event does not fail' );
        } );
 
-       QUnit.test( 'connect', 2, function ( assert ) {
+       QUnit.test( 'connect', 3, function ( assert ) {
                var data1, host,
                        ee = new oo.EventEmitter();
 
@@ -157,11 +157,15 @@
 
                ee.connect( host, {
                        foo: 'onFoo',
-                       bar: [ 'barbara', data1 ]
+                       bar: [ 'barbara', data1 ],
+                       quux: function () {
+                               assert.ok( true, 'Callback ran' );
+                       }
                } );
 
                ee.emit( 'foo' );
                ee.emit( 'bar' );
+               ee.emit( 'quux' );
        } );
 
        QUnit.test( 'disconnect( host )', 1, function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/141961
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I805dd75611cca407f43fce86d0521df4307e26d0
Gerrit-PatchSet: 3
Gerrit-Project: oojs/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to