1
0
Fork 0

Can now specify parent class in extend() when implementing atop an empty base

closure/master
Mike Gerwitz 2011-03-16 19:24:02 -04:00
parent 80f3ec6b68
commit 14cac6b461
2 changed files with 20 additions and 1 deletions

View File

@ -113,7 +113,7 @@ module.exports.implement = function()
{ {
// implement on empty base // implement on empty base
return createImplement( return createImplement(
module.exports.extend(), null,
Array.prototype.slice.call( arguments ) Array.prototype.slice.call( arguments )
); );
}; };

View File

@ -213,3 +213,22 @@ var Type = Interface.extend( {
); );
} )(); } )();
/**
* Opposite of the above test. If a parent wasn't specified to begin with, then
* we're fine to specify it in extend().
*/
( function testCanSpecifyParentIfImplementingAtopEmptyClass()
{
assert.doesNotThrow(
function()
{
// this /should/ work
Class.implement( Type ).extend( PlainFoo, {} );
},
Error,
"Can specify parent for exetnd() when implementing atop an " +
"empty base"
);
} )();