Thursday, January 23, 2020

How do I set an input at an Angular component in Jasmine/Karma testing?

beforeEach(() => {
   fixture = TestBed.createComponent(GridComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
});

 
 

What is above could become:

beforeEach(() => {
   fixture = TestBed.createComponent(GridComponent);
   component = fixture.componentInstance;
   component.contents = {
      columns: [
         { name: "DistributorId" },
         { name: "FirstLastName" },
         { name: "LevelType" },
         { name: "Status" },
         { name: "CityState" }
      ],
      data:[]
   };
   fixture.detectChanges();
});

No comments:

Post a Comment