1
0
Fork 0

Added tests to ensure it is possible to extend classes that were not previously created using Class.extend()

closure/master
Mike Gerwitz 2010-11-11 21:02:09 -05:00
parent e56ecce61f
commit 97f3c5ed5d
1 changed files with 27 additions and 0 deletions

View File

@ -99,3 +99,30 @@ assert.ok(
"Subtypes should not be considered instances of their siblings"
);
// to test inheritance of classes that were not previously created via the
// Class.extend() method
var OtherClass = function() {};
OtherClass.prototype =
{
foo: 'bla',
};
var SubOther = Class.extend( OtherClass,
{
newFoo: 2,
});
assert.equal(
SubOther.prototype.foo,
OtherClass.prototype.foo,
"Prototype of existing class should be copied to subclass"
);
assert.notEqual(
SubOther.prototype.newFoo,
undefined,
"Subtype should contain extended members"
);