Hi, I’m writing unit tests and can’t seem to get click events working.
When my element is visible and i click the element, nothing happens.
I’ve also noticed fixture.nativeElement doesn’t actually change from the time it was initialized in the beforeEach method, but i guess that might be because of my original problem of not being able to click a button!
Using Ionic v4 beta, Angular 6 & Jest.
My test config:
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [TestPage],
imports: [
IonicModule.forRoot(TestPage),
BrowserModule,
CommonModule,
FormsModule,
RouterTestingModule],
providers: [{provide: Platform, useClass: PlatformMock},],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
}).compileComponents();
});
i use this for example to click a segment button
this.fixture.nativeElement.querySelector('ion-segment').click()