小编A. *_*ius的帖子

Angular2“最终”单元测试覆盖指令

我正在使用 Angular 2 Final,并使用 TestBed 进行单元测试

我在使用“ overrideDirective ”时遇到问题,似乎正在调用实际指令,因为我收到错误“ No provider for Config! ” 被替换的 MyDirective 依赖于该错误。

组件视图

  <div>
       <input myDirective>
       // some more logic etc...
  </div>
Run Code Online (Sandbox Code Playgroud)

替换指令

@Directive({
    selector: "myDirective"
})
class MyDirective{
    constructor(
        private config: Config
    ) {
    }
}
Run Code Online (Sandbox Code Playgroud)

规格文件

@Component({
    template: "<my-component></my-component>"
})
class TestComponent{

}

@Directive({
    selector: "fake"
})
class FakeDirective {

}

beforeEach(() => {
    TestBed.configureTestingModule({
        declarations: [
            MyComponent,
            MyDirective,
            TestComponent,
            FakeDirective
        ]
    });
});

beforeEach(async(() => {
    TestBed
        .overrideDirective(MyDirective, FakeDirective)
        .compileComponents();
    fixture = …
Run Code Online (Sandbox Code Playgroud)

unit-testing angular

5
推荐指数
0
解决办法
1267
查看次数

带双支架的VB.NET数组()()

我在变量名称之后得到了一个双重括号,我想知道它是什么意思.

以下是什么意思?

Private orgIdField()() As String
Run Code Online (Sandbox Code Playgroud)

我才知道;

Private orgIdField() As String
Run Code Online (Sandbox Code Playgroud)

.net vb.net arrays brackets multidimensional-array

4
推荐指数
1
解决办法
504
查看次数