Interface prototype contains defined methods
parent
789c7f9b5e
commit
84dcca35d2
|
@ -54,7 +54,12 @@ function extend()
|
|||
base = args.pop() || Interface,
|
||||
prototype = new base();
|
||||
|
||||
var new_interface = {};
|
||||
var new_interface = function() {};
|
||||
|
||||
util.propCopy( props, prototype );
|
||||
|
||||
new_interface.prototype = prototype;
|
||||
new_interface.constructor = new_interface;
|
||||
|
||||
// freeze the interface (preventing additions), if supported
|
||||
util.freeze( new_interface );
|
||||
|
|
|
@ -59,3 +59,14 @@ assert.doesNotThrow(
|
|||
"Abstract method declarations are allowed within Interface definitions"
|
||||
);
|
||||
|
||||
|
||||
var BaseType = Interface.extend(
|
||||
{
|
||||
method: abstractMethod(),
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
( BaseType.prototype.method instanceof Function ),
|
||||
"Interface contains defined abstract methods"
|
||||
);
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ var FooType = Interface.extend();
|
|||
|
||||
|
||||
assert.ok(
|
||||
( FooType instanceof Object ),
|
||||
"Interface extend method creates a new object"
|
||||
( FooType instanceof Function ),
|
||||
"Interface extend method creates a new interface object"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
|
|
Loading…
Reference in New Issue