Victor
unread,Jan 10, 2012, 3:21:10 AM1/10/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to prototype-s...@googlegroups.com
As part of scriptaculous' unit test:
testAnonSubclass: function() {
var C1 = Class.create({
method1: function() {
return "C1";
}
}), C2 = Class.create(C1, {
method2: function() {
return "C2";
},
createSubclass: function() {
return Class.create(this.constructor, {
method3: function() {
return "subclass";
}
});
}
});
var o2 = new C2(), C3 = o2.createSubclass(), o3 = new C3();
this.assertInstanceOf(C1, o2, "o2 instanceOf C1");
this.assertInstanceOf(C2, o2, "o2 instanceOf C2");
this.assertInstanceOf(C1, o3, "o3 instanceOf C1");
this.assertInstanceOf(C2, o3, "o3 instanceOf C2");
this.assert(Object.isFunction(o3.method1), "o3.method1");
this.assert(Object.isFunction(o3.method2), "o3.method2");
this.assert(Object.isFunction(o3.method3), "o3.method3");
}