Angular tests failing with Failed to execute 'send' on 'XMLHttpRequest'

后端 未结 11 1758
春和景丽
春和景丽 2020-12-12 12:11

I am trying to test my angular 4.1.0 component -

export class CellComponent implements OnInit {
  lines: Observable>;
  @Input() dep         


        
11条回答
  •  情深已故
    2020-12-12 12:50

    You can either set input() property to default value in component.ts

    @Input() tableColumns: Array = [];  
    @Input() pageObj: any = '';
    

    OR

    Modify your component.spec.ts file in following way,

    beforeEach(() => {  
       fixture = TestBed.createComponent(MyComponent);  
       component = fixture.componentInstance;  
       component.tableColumns = [];  
       component.pageObj = '';  
       fixture.detectChanges();  
    });
    

提交回复
热议问题