egs-cm / template-lint

Sanity check of Aurelia-flavor template HTML
Apache License 2.0
0 stars 0 forks source link

Finding inherited property fails via default export/import #9

Open egs-cm opened 1 year ago

egs-cm commented 1 year ago

Inherited properties will not be found when default-imported.

  it("supports inheritance of classes on default export/import", (done) => {
    let base = `
    export default class Base{
      value:string;
    }`;

    let viewmodel = `
    import Base from './base
    export class Foo extends Base{
    }`;

    let view = `
    <template>    
      \${value}
      \${valu}
    </template>`;
    let reflection = new Reflection();
    let rule = new BindingRule(reflection, new AureliaReflection());
    let linter = new Linter([rule]);
    reflection.add("./foo.ts", viewmodel);
    reflection.add("./base.ts", base);
    linter.lint(view, "./foo.html")
      .then((issues) => {
        try {
          expect(issues.length).toBe(1);
          expect(issues[0].message).toBe("cannot find 'valu' in type 'Foo'");
        }
        catch (err) { fail(err); }
        finally { done(); }
      });
  });