UNPKG

proteus

Version:

A declarative way of creating objects, properties, and classes in ES5 JavaScript

36 lines (25 loc) 893 B
var should = require("should"), Proteus = require("proteus") ; suite("Class Definition", function () { test("Exists", function () { should.exist(Proteus); Proteus.Class.should.be.a("function"); Proteus.Class.derive.should.be.a("function"); }); test("Create Class", function () { var BaseClass = Proteus.Class.derive({ foo: "foo" }); var instance = new BaseClass(); BaseClass.__super__.should.eql(Proteus.Class.prototype); instance.foo.should.eql("foo"); }); test("Instance of", function () { var BaseClass = Proteus.Class.derive(); var SubClass = BaseClass.derive(); var instance = new SubClass(); instance.should.be.an.instanceof(SubClass); instance.should.be.an.instanceof(BaseClass); }); });