feat: allow Type.annotations = Component(...).View(...)

Closes #2577
This commit is contained in:
Misko Hevery
2015-06-16 16:13:31 -07:00
parent eb3586d777
commit b2c66949b2
2 changed files with 21 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import {
} from 'angular2/test_lib';
import {Component, View, Directive} from 'angular2/angular2';
import {reflector} from 'angular2/src/reflection/reflection';
export function main() {
describe('es5 decorators', () => {
@ -24,5 +25,12 @@ export function main() {
Component({}).View({}).View({}).Class({constructor: function() { this.works = true; }});
expect(new MyComponent().works).toEqual(true);
});
it('should create type in ES5', () => {
function MyComponent(){};
var as;
(<any>MyComponent).annotations = as = Component({}).View({});
expect(reflector.annotations(MyComponent)).toEqual(as.annotations);
});
});
}