Answers for "ionic 4 unit testing example for modalcontroller"

0

ionic 4 unit testing example for modalcontroller

it('should display the Add photo modal when the button is clicked and logged in', () => {

    let pub = {
        phone: '123123'
    }

    component.pub = pub;
    let authService = fixture.debugElement.injector.get(AuthService);

    authService.loginWithEmail();
    fixture.detectChanges();

    expect(authService.authenticated).toBe(true);


    let modal = fixture.debugElement.injector.get(Modal);
    spyOn(modal, 'present');
    debugElementArray = helper.getAllByCss(fixture, 'ion-col button');

    debugElementArray[0].triggerEventHandler('click', null);
    expect(modal.present).toHaveBeenCalled();

});
Posted by: Guest on October-19-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language