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

Change subject: test: Add test for copy( Object, Function callback )
......................................................................


test: Add test for copy( Object, Function callback )

Increasing code coverage.

Change-Id: I040018a0cfb0bc4948faf338f53cefb7709e59ad
---
M test/unit/core.test.js
1 file changed, 32 insertions(+), 0 deletions(-)

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



diff --git a/test/unit/core.test.js b/test/unit/core.test.js
index bf4689b..87ee893 100644
--- a/test/unit/core.test.js
+++ b/test/unit/core.test.js
@@ -584,6 +584,38 @@
                );
        } );
 
+       QUnit.test( 'copy( source, Function callback )', 2, function ( assert ) 
{
+               function Cloneable( name ) {
+                       this.name = name;
+                       this.clone = function () {
+                               return new Cloneable( this.name + '-clone' );
+                       };
+               }
+
+               assert.deepEqual(
+                       oo.copy(
+                               { foo: 'bar', baz: [ 1 ] },
+                               function ( val ) {
+                                       return 'mod-' + val;
+                               }
+                       ),
+                       { foo: 'mod-bar', baz: [ 'mod-1' ] },
+                       'Callback on primitive values'
+               );
+
+               assert.deepEqual(
+                       oo.copy(
+                               [ new Cloneable( 'callback' ) ],
+                               function ( val ) {
+                                       val.name += '-mod';
+                                       return val;
+                               }
+                       ),
+                       [ new Cloneable( 'callback-clone-mod' ) ],
+                       'Callback on cloneables'
+               );
+       } );
+
        QUnit.test( 'getHash: Basic usage', 7, function ( assert ) {
                var tmp, key,
                        cases = {},

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I040018a0cfb0bc4948faf338f53cefb7709e59ad
Gerrit-PatchSet: 5
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