diff --git a/modules/ve/test/ve.test.js b/modules/ve/test/ve.test.js index a48a1d0100..1ddab76291 100644 --- a/modules/ve/test/ve.test.js +++ b/modules/ve/test/ve.test.js @@ -9,37 +9,6 @@ QUnit.module( 've' ); /* Tests */ -// ve.createObject: Tested upstream (JavaScript) - -// ve.inheritClass: Tested upstream (OOJS) - -// ve.mixinClass: Tested upstream (OOJS) - -QUnit.test( 'isMixedIn', 11, function ( assert ) { - function Foo () {} - function Bar () {} - function Quux () {} - - ve.inheritClass( Quux, Foo ); - ve.mixinClass( Quux, Bar ); - - var b = new Bar(), - q = new Quux(); - - assert.strictEqual( ve.isMixedIn( Foo, Function ), false, 'Direct native inheritance is not considered' ); - assert.strictEqual( ve.isMixedIn( Foo, Object ), false, 'Indirect native inheritance is not considered' ); - assert.strictEqual( ve.isMixedIn( Quux, Foo ), false, 've.inheritClass does not affect mixin status' ); - assert.strictEqual( ve.isMixedIn( Foo, Foo ), false, 'Foo does not mixin Foo' ); - assert.strictEqual( ve.isMixedIn( Bar, Foo ), false, 'Bar does not mixin Foo' ); - assert.strictEqual( ve.isMixedIn( Quux, Bar ), true, 'Quux has Bar mixed in' ); - assert.strictEqual( ve.isMixedIn( Bar, Quux ), false, 'Bar does not mixin Quux' ); - - assert.strictEqual( ve.isMixedIn( q, Foo ), false, 've.inheritClass does not affect mixin status' ); - assert.strictEqual( ve.isMixedIn( b, Foo ), false, 'b does not mixin Foo' ); - assert.strictEqual( ve.isMixedIn( q, Bar ), true, 'q has Bar mixed in' ); - assert.strictEqual( ve.isMixedIn( b, Quux ), false, 'b does not mixin Quux' ); -} ); - // ve.cloneObject: Tested upstream (OOJS) // ve.getObjectValues: Tested upstream (OOJS) diff --git a/modules/ve/ve.js b/modules/ve/ve.js index 9365984530..782067eddc 100644 --- a/modules/ve/ve.js +++ b/modules/ve/ve.js @@ -62,28 +62,7 @@ * @method * @inheritdoc OO#mixinClass */ - ve.mixinClass = function ( targetFn, originFn ) { - oo.mixinClass( targetFn, originFn ); - - // Track mixins - targetFn.mixins = targetFn.mixins || []; - targetFn.mixins.push( originFn ); - }; - - /** - * Check if a constructor or object contains a certain mixin. - * - * @param {Function|Object} a Class or object to check - * @param {Function} mixin Mixin to check for - * @returns {boolean} Class or object uses mixin - */ - ve.isMixedIn = function ( subject, mixin ) { - // Traverse from instances to the constructor - if ( $.type( subject ) !== 'function' ) { - subject = subject.constructor; - } - return !!subject.mixins && subject.mixins.indexOf( mixin ) !== -1; - }; + ve.mixinClass = oo.mixinClass; /** * @method