Classes now return a more intuitive string representation
parent
79be82e536
commit
d19638be4f
|
@ -327,6 +327,12 @@ var extend = ( function( extending )
|
|||
attachInstanceOf( this );
|
||||
};
|
||||
|
||||
// provide a more intuitive string representation
|
||||
__self.toString = function()
|
||||
{
|
||||
return '<Class>';
|
||||
};
|
||||
|
||||
return __self;
|
||||
}
|
||||
// abstract class
|
||||
|
|
|
@ -224,3 +224,15 @@ assert.ok(
|
|||
"Instances of subtypes do not share property references"
|
||||
);
|
||||
|
||||
|
||||
// otherwise it'll output the internal constructor code, which is especially
|
||||
// confusing since the user does not write it
|
||||
( function testConvertingClassToStringYieldsClassString()
|
||||
{
|
||||
assert.equal(
|
||||
Class.extend( {} ).toString(),
|
||||
'<Class>',
|
||||
"Converting class to string yields class string"
|
||||
);
|
||||
} )();
|
||||
|
||||
|
|
Loading…
Reference in New Issue