Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141944

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/core refs/changes/44/141944/1

diff --git a/test/unit/core.test.js b/test/unit/core.test.js
index 803c994..361a224 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: newchange
Gerrit-Change-Id: I040018a0cfb0bc4948faf338f53cefb7709e59ad
Gerrit-PatchSet: 1
Gerrit-Project: oojs/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

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

Reply via email to