Krinkle has uploaded a new change for review.

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

Change subject: test: Add test for mixinClass with static properties
......................................................................

test: Add test for mixinClass with static properties

Increasing code coverage.

Change-Id: I1017484388c785f9ece90ae6fb5d1847bc449ab3
---
M test/unit/core.test.js
1 file changed, 25 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/core refs/changes/36/141936/1

diff --git a/test/unit/core.test.js b/test/unit/core.test.js
index 87bca14..d14d985 100644
--- a/test/unit/core.test.js
+++ b/test/unit/core.test.js
@@ -134,29 +134,36 @@
                assert.equal( bar.eFn(), 'proto of Foo', 'inheritance is live 
(adding a new method deeper in the chain)' );
        } );
 
-       QUnit.test( 'mixinClass', 4, function ( assert ) {
+       QUnit.test( 'mixinClass', 6, function ( assert ) {
                var quux;
 
                function Foo() {}
-               Foo.prototype.aFn = function () {
-                       return 'proto of Foo';
+               oo.initClass( Foo );
+               Foo.static.xFoo = true;
+               Foo.prototype.isFoo = function () {
+                       return 'method of Foo';
                };
 
                function Bar() {}
-               // oo.inheritClass makes the 'constructor'
-               // property an own property when it restores it.
                oo.inheritClass( Bar, Foo );
-               Bar.prototype.bFn = function () {
-                       return 'mixin of Bar';
+               Bar.static.xBar = true;
+               Bar.prototype.isBar = function () {
+                       return 'method of Bar';
                };
 
                function Quux() {}
                oo.mixinClass( Quux, Bar );
 
                assert.strictEqual(
-                       Quux.prototype.aFn,
+                       Quux.prototype.isFoo,
                        undefined,
-                       'mixin inheritance is not copied over'
+                       'method inherited by mixin is not copied over'
+               );
+
+               assert.strictEqual(
+                       Quux.static.xFoo,
+                       undefined,
+                       'static inherited by mixin is not copied over'
                );
 
                assert.strictEqual(
@@ -166,14 +173,20 @@
                );
 
                assert.strictEqual(
-                       Quux.prototype.hasOwnProperty( 'bFn' ),
+                       Quux.prototype.hasOwnProperty( 'isBar' ),
                        true,
-                       'mixin properties are now own properties, not inherited'
+                       'mixin method became own property'
+               );
+
+               assert.strictEqual(
+                       Quux.static.hasOwnProperty( 'xBar' ),
+                       true,
+                       'mixin static property became own property'
                );
 
                quux = new Quux();
 
-               assert.equal( quux.bFn(), 'mixin of Bar', 'mixin method works 
as expected' );
+               assert.equal( quux.isBar(), 'method of Bar', 'method works as 
expected' );
        } );
 
        QUnit.test( 'cloneObject', 4, function ( assert ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1017484388c785f9ece90ae6fb5d1847bc449ab3
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