import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ContactListPage } from './contact-list.page'; describe('ContactListPage', () => { let component: ContactListPage; let fixture: ComponentFixture; beforeEach(() => { fixture = TestBed.createComponent(ContactListPage); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('#clicked() should toggle #isOn', () => { const comp = new ContactListPage(); expect(comp.isOn).withContext('off at first').toBe(false); comp.clicked(); expect(comp.isOn).withContext('on after click').toBe(true); comp.clicked(); expect(comp.isOn).withContext('off after second click').toBe(false); }); });