运行实习测试时加载dojo补丁文件

时间:2017-05-22 22:33:33

标签: dojo intern

使用dojo,可以通过补丁/补丁创建和加载补丁文件!'其中patch.js包含所有补丁的加载函数。

内容patch.js

@HostBinding('style.overflow-y') overflowY = 'scroll';


  @Component({
    selector: 'my-app',
    template: `
      <div>
        <button (click)="addStyle()">Add Style</button>
        <h2>Hello</h2>
      </div>`,  styles: [
    `
    :host {
       overflow-x: hidden;
      height: 50px;
      width:200px;
      display:block;
    }
    `
    ]
  })
  export class App {
    name:string;

    @HostBinding('style.overflow-y') 
     overflowY = 'scroll';

    constructor() {}

    addStyle() {
      this.overflowY= 'hidden';
    }
  }

运行实习套件时,我希望在运行套件之前先加载这些补丁。 有没有办法确保在运行我的测试套件之前加载我的补丁文件。

关心Marco

1 个答案:

答案 0 :(得分:0)

定义测试套件时,您可以使用before函数调用加载补丁函数

define(["intern!tdd", "patch"], function (tdd, patch) {
    tdd.describe("Tests suite", function () {
        tdd.before(function () {
            // executes before suite starts
            patch.load();
        });
    });
});