Property binding matHeaderRowDef not used by any directive on an embedded template
We have had exactly the same issue concerning the property matHeaderRowDef and also matRowDefColumns. We solved it by simply importing the material table module, i.e. MatTableModule, in the unit test spec file.
Specifically, we imported it in the initial declarations and then within the beforeEach block.
To better clarify, here is the my-awesome.component.spec.ts file:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MyAwesomeComponent } from './my-awesome.component';
import { MatTableModule } from '@angular/material';
describe('MyAwesomeComponent', () => {
let component: MyAwesomeComponent;
let fixture: ComponentFixture<MyAwesomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MyAwesomeComponent ],
imports: [ MatTableModule ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MyAwesomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Hope this helps :)