Tests/Specs: Use Chai for assertions, instead of Jasmine's assertions.
[mootools.git] / Specs / Core / Type.js
blobc1278fb1082dcf9db0686f04fc15c6e5083fc420
1 /*
2 ---
3 name: Type
4 requires: ~
5 provides: ~
6 ...
7 */
9 (function(){
11 var Instrument = new Type('Instrument', function(name){
12         this.name = name;
13 });
15 Instrument.implement({
17         method: function(){
18                 return this.property + ' ' + this.name;
19         },
21         property: 'stuff'
23 });
25 var Car = new Type('Car', function(name){
26         this.name = name;
27 });
29 Car.implement({
31         property: 'stuff',
33         method: function(){
34                 return this.name + '_' + this.property;
35         }
37 });
39 describe('Type (private)', function(){
41         it('should allow implementation over existing methods when browser option is not set', function(){
42                 Instrument.implement({ property: 'staff' });
43                 var myInstrument = new Instrument('xeelophone');
44                 expect(myInstrument.method()).to.equal('staff xeelophone');
45         });
47         it('should allow generic calls', function(){
48                 expect(Car.method({name: 'ciccio', property: 'bello'})).to.equal('ciccio_bello');
49         });
51         it("should have a 'native' type", function(){
52                 expect(Type.isType(Car)).to.equal(true);
53         });
55 });
57 })();