TypeScript @angular-compiler-testing-resource_loader_mock.MockResourceLoader类(方法)实例源码

下面列出了TypeScript @angular-compiler-testing-resource_loader_mock.MockResourceLoader 类(方法)源码代码实例,从而了解它的用法。

作者:awerlan    项目:angula   
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer,
  resourceLoader: MockResourceLoader) => {
   resourceLoader.expect('package:some/module/tpl/sometplurl.html', '');
   normalizer
       .normalizeTemplateAsync(dirType, new CompileTemplateMetadata({
                                 encapsulation: null,
                                 template: null,
                                 templateUrl: 'tpl/sometplurl.html',
                                 styles: [],
                                 styleUrls: ['test.css']
                               }))
       .then((template: CompileTemplateMetadata) => {
         expect(template.styleUrls).toEqual(['package:some/module/test.css']);
         async.done();
       });
   resourceLoader.flush();
 }));

作者:DzmitryShylovic    项目:angula   
(async: AsyncTestCompleter, normalizer: DirectiveNormalizer,
  resourceLoader: MockResourceLoader) => {
   resourceLoader.expect('package:some/module/cmp.html', 'a');
   const prenormMeta = {
     componentType: SomeComp,
     moduleUrl: SOME_MODULE_URL,
     templateUrl: 'cmp.html',
   };
   Promise
       .all([
         normalizer.normalizeTemplateAsync(prenormMeta),
         normalizer.normalizeTemplateAsync(prenormMeta)
       ])
       .then((templates: CompileTemplateMetadata[]) => {
         expect(templates[0].template).toEqual('a');
         expect(templates[1].template).toEqual('a');
         async.done();
       });
   resourceLoader.flush();
 }));

作者:xphon    项目:angula   
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
   var url = '/foo';
   var response = 'bar';
   resourceLoader.expect(url, response);
   expectResponse(resourceLoader.get(url), url, response, () => async.done());
   resourceLoader.flush();
 }));

作者:AlmogShau    项目:angula   
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
   const url = '/foo';
   const response: string = null;
   resourceLoader.expect(url, response);
   expectResponse(resourceLoader.get(url), url, response, () => async.done());
   resourceLoader.flush();
 }));

作者:xphon    项目:angula   
it('should not reuse expectations', () => {
   var url = '/foo';
   var response = 'bar';
   resourceLoader.expect(url, response);
   resourceLoader.get(url);
   resourceLoader.get(url);
   expect(() => { resourceLoader.flush(); }).toThrowError('Unexpected request /foo');
 });


问题


面经


文章

微信
公众号

扫码关注公众号