feat(transpiler): add support for getters

This commit is contained in:
vsavkin
2014-10-16 16:10:21 -04:00
parent 2f732c6b84
commit 035dc5ba44
2 changed files with 41 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import {describe, it, expect} from 'test_lib/test_lib';
import {ddescribe, describe, it, expect} from 'test_lib/test_lib';
import {CONST} from './fixtures/annotations';
// Constructor
@ -36,6 +36,16 @@ class SubConst extends Const {
}
}
class HasGetters {
get getter():string {
return 'getter';
}
static get staticGetter():string {
return 'getter';
}
}
export function main() {
describe('classes', function() {
it('should work', function() {
@ -60,6 +70,17 @@ export function main() {
expect(subFoo.c).toBe(3);
});
});
describe("getters", function () {
it("should call instance getters", function () {
var obj = new HasGetters();
expect(obj.getter).toEqual('getter');
});
it("should call static getters", function () {
expect(HasGetters.staticGetter).toEqual('getter');
});
});
});
}