TypeScript @angular-compiler-src-pipe_resolver.PipeResolver类(方法)实例源码

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

作者:DzmitryShylovic    项目:angula   
describe('PipeResolver', () => {
    let resolver: PipeResolver;

    beforeEach(() => { resolver = new PipeResolver(); });

    it('should read out the metadata from the class', () => {
      const moduleMetadata = resolver.resolve(SomePipe);
      expect(moduleMetadata).toEqual(new Pipe({name: 'somePipe', pure: true}));
    });

    it('should throw when simple class has no pipe decorator', () => {
      expect(() => resolver.resolve(SimpleClass))
          .toThrowError(`No Pipe decorator found on ${stringify(SimpleClass)}`);
    });

    it('should support inheriting the metadata', function() {
      @Pipe({name: 'p'})
      class Parent {
      }

      class ChildNoDecorator extends Parent {}

      @Pipe({name: 'c'})
      class ChildWithDecorator extends Parent {
      }

      expect(resolver.resolve(ChildNoDecorator)).toEqual(new Pipe({name: 'p'}));

      expect(resolver.resolve(ChildWithDecorator)).toEqual(new Pipe({name: 'c'}));
    });

  });

作者:DzmitryShylovic    项目:angula   
it('should support inheriting the metadata', function() {
      @Pipe({name: 'p'})
      class Parent {
      }

      class ChildNoDecorator extends Parent {}

      @Pipe({name: 'c'})
      class ChildWithDecorator extends Parent {
      }

      expect(resolver.resolve(ChildNoDecorator)).toEqual(new Pipe({name: 'p'}));

      expect(resolver.resolve(ChildWithDecorator)).toEqual(new Pipe({name: 'c'}));
    });

作者:DzmitryShylovic    项目:angula   
expect(() => resolver.resolve(SimpleClass))


问题


面经


文章

微信
公众号

扫码关注公众号