作者:AudreyCha
项目:angula
describe('Compiler', () => {
var someCompFactory: any /** TODO #9100 */;
var compiler: ComponentResolver;
beforeEach(() => {
someCompFactory = new ComponentFactory(null, null, null);
reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory]));
compiler = new ReflectorComponentResolver(new DummyConsole());
});
it('should read the template from an annotation',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compiler.resolveComponent(SomeComponent).then((compFactory: ComponentFactory<any>) => {
expect(compFactory).toBe(someCompFactory);
async.done();
return null;
});
}));
it('should throw when given a string',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compiler.resolveComponent('someString').catch((e) => {
expect(e.message).toContain('Cannot resolve component using \'someString\'.')
async.done();
});
}));
});
作者:0xJoK
项目:angula
inject([AsyncTestCompleter, ComponentResolver], (async, compiler: ComponentResolver) => {
compiler.resolveComponent("someString")
.catch((e) => {
expect(e.message).toContain("Cannot resolve component using 'someString'.")
async.done();
});
}));
作者:AudreyCha
项目:angula
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
compiler.resolveComponent(SomeComponent).then((compFactory: ComponentFactory<any>) => {
expect(compFactory).toBe(someCompFactory);
async.done();
return null;
});
}));