ngModel
value to the <mat-select> (along with the other template form properties like an <input>
tag) and it will automatically "match" with the values set for the options
multiple
your still comparing objects to objects which I don't think works if the references aren't the same
Hello, I'm trying to write unit tests for a component and I keep getting this error Error: MatDatepicker: No provider found for DateAdapter. You must import one of the following modules at your application root: MatNativeDateModule, MatMomentDateModule, or provide a custom implementation.
My testbed :
describe('DateSelectComponent', () => {
// Define Testbed
let spectator: Spectator<DateSelectComponent>
const createComponent = createComponentFactory({
component: DateSelectComponent,
imports: [
MatFormFieldModule,
MatDatepickerModule,
CommonModule,
MatMomentDateModule,
MatInputModule,
TranslateModule.forRoot({
defaultLanguage: "ar",
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
providers: [
HttpClient,
{
provide: MAT_DATE_FORMATS,
useValue: MY_FORMATS
}
]
});
beforeEach(() => spectator = createComponent())
// Tests
it('Should load', () => {
expect(spectator.component).toBeTruthy()
})
})
import { MatFormFieldModule } from "@angular/material/form-field"
import { MatDatepickerModule } from "@angular/material/datepicker";
import { MatInputModule } from "@angular/material/input";
import { MatMomentDateModule } from "@angular/material-moment-adapter";