当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript template-lint.Linter类代码示例

本文整理汇总了TypeScript中template-lint.Linter的典型用法代码示例。如果您正苦于以下问题:TypeScript Linter类的具体用法?TypeScript Linter怎么用?TypeScript Linter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Linter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

  it("supports delegate binding", (done) => {
    let pageViewModel = `
    export class Page {
      value:number;
      public submit() {       
      }
    }`;

    let pageView = `
    <template>
      \${value}
      <form role="form" submit.delegate="submit()"></form>
      <form role="form" submit.delegate="submt()"></form>
    </template>`;

    let reflection = new Reflection();
    let rule = new BindingRule(reflection, new AureliaReflection(), { reportExceptions: true });
    let linter = new Linter([rule]);
    reflection.add("./page.ts", pageViewModel);
    linter.lint(pageView, "./page.html")
      .then((issues) => {
        try {
          expect(issues.length).toBe(1);
          expect(issues[0].message).toBe("cannot find 'submt' in type 'Page'");
        }
        catch (err) { fail(err); }
        finally { done(); }
      });
  });
开发者ID:MeirionHughes,项目名称:aurelia-template-lint,代码行数:29,代码来源:binding.spec.ts

示例2: it

  it("supports getters", (done) => {
    let item = `
    export class Item{
      value:string;
    }`;

    let viewmodel = `
    import {Item} from './path/item
    export class Foo{
      get item(): Item {}
    }`
    let view = `
    <template>    
      \${item}
      \${item.value}
      \${item.vale}
    </template>`
    let reflection = new Reflection();
    let rule = new BindingRule(reflection);
    let linter = new Linter([rule]);
    reflection.add("./foo.ts", viewmodel);
    reflection.add("./path/item", item);
    linter.lint(view, "./foo.html")
      .then((issues) => {
        try {
          expect(issues.length).toBe(1);
          expect(issues[0].message).toBe("cannot find 'vale' in type 'Item'");
        } 
        catch(err){fail(err);}
        finally { done(); }
      })
  });
开发者ID:atsu85,项目名称:aurelia-template-lint,代码行数:32,代码来源:binding.spec.ts

示例3: xit

 xit("should detect invalid references", (done) => {
   const viewmodel = `
   export class Foo{
     field1: number;
     field2: number;
     
     @computedFrom("field1", "missingField1", "field2", "missingField2")
     get computedField(){
       return this.field1 + this.field2;
     }
   }`;
   const view = `
   <template>
     \${computedField}
   </template>`;
   const reflection = new Reflection();
   const rule = new BindingRule(reflection, new AureliaReflection());
   const linter = new Linter([rule]);
   reflection.add("./foo.ts", viewmodel);
   linter.lint(view, "./foo.html")
     .then((issues) => {
       try {
         expect(issues.length).toBe(2);
         expect(issues[0].message).toBe("cannot find 'missingField1' in type 'Foo'");
         expect(issues[1].message).toBe("cannot find 'missingField2' in type 'Foo'");
       }
       catch (err) {
         fail(err);
       }
       finally {
         done();
       }
     });
 });
开发者ID:MeirionHughes,项目名称:aurelia-template-lint,代码行数:34,代码来源:binding.spec.ts


注:本文中的template-lint.Linter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。