add dist files builder and tester to Gruntfile
[mootools.git] / Specs / Core / Native.js
blobbcb94933e42d569508a6399dbdb9be2a5aa309ff
1 /*
2 ---
3 name: Native
4 requires: ~
5 provides: ~
6 ...
7 */
9 //<1.2compat>
10 (function(){
12 var Instrument = new Native({
14         name: 'instrument',
16         initialize: function(name){
17                 this.name = name;
18         }
20 });
22 Instrument.implement({
24         method: function(){
25                 return this.property + ' ' + this.name;
26         },
28         property: 'stuff'
30 });
32 var Car = new Native({
34         name: 'car',
36         initialize: function(name){
37                 this.name = name;
38         }
40 });
42 Car.implement({
44         property: 'stuff',
46         method: function(){
47                 return this.name + '_' + this.property;
48         }
50 });
52 describe('Native (private)', function(){
54         it('should allow implementation over existing methods when browser option is not set', function(){
55                 Instrument.implement({ property: 'staff' });
56                 var myInstrument = new Instrument('xeelophone');
57                 expect(myInstrument.method()).toEqual('staff xeelophone');
58         });
60         it('should allow generic calls', function(){
61                 expect(Car.method({name: 'ciccio', property: 'bello'})).toEqual('ciccio_bello');
62         });
64         it("should have a 'native' type", function(){
65                 expect(Native.type(Car)).toBeTruthy();
66         });
68 });
70 })();
71 //</1.2compat>