I am using an attribute selector component called app-product-row on a tr tag and im passing product in an @Input() as follows;
class
@Component({
selector: '[app-product-row]',
templateUrl: './product-row.component.html',
styleUrls: ['./product-row.component.scss']
})
export class ProductRowComponent {
@Input() public product = null;
}
TestBed
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductRowComponent } from './product-row.component';
describe('ProductRowComponent', () => {
let component: ProductRowComponent;
let fixture: ComponentFixture<ProductRowComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProductRowComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ProductRowComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
markup
<tr *ngFor="let product of searchResults"
[product]="product"
(showPipelineModalChange)="onShowPipelineModalChange($event)"
app-product-row>
</tr>
the code compiles successfully upon ng serve and everything works as expected on the browser however unit tests are throwing
Chrome 63.0.3239 (Mac OS X 10.13.3)
Can't bind to 'product' since it isn't a known property of 'tr'
My implementation took inspiration from Angular2 table rows as component however in that example @Input()'s dont seem to be used and there is no mention of unit testing either.
could someone please point me in the right direction?