angular-cn/tools/transpiler/spec/classes_spec.js

27 lines
439 B
JavaScript
Raw Normal View History

import {describe, it, expect} from 'test_lib/test_lib';
2014-09-25 17:30:10 -04:00
// Constructor
// Define fields
class Foo {
constructor(a, b) {
this.a = a;
this.b = b;
}
sum() {
return this.a + this.b;
}
}
export function main() {
describe('classes', function() {
it('should work', function() {
var foo = new Foo(2, 3);
2014-09-25 17:30:10 -04:00
expect(foo.a).toBe(2);
expect(foo.b).toBe(3);
expect(foo.sum()).toBe(5);
});
});
2014-09-25 17:30:10 -04:00
}