contact-list.page.spec.ts 810 B

1234567891011121314151617181920212223242526
  1. import { ComponentFixture, TestBed } from '@angular/core/testing';
  2. import { ContactListPage } from './contact-list.page';
  3. describe('ContactListPage', () => {
  4. let component: ContactListPage;
  5. let fixture: ComponentFixture<ContactListPage>;
  6. beforeEach(() => {
  7. fixture = TestBed.createComponent(ContactListPage);
  8. component = fixture.componentInstance;
  9. fixture.detectChanges();
  10. });
  11. it('should create', () => {
  12. expect(component).toBeTruthy();
  13. });
  14. it('#clicked() should toggle #isOn', () => {
  15. const comp = new ContactListPage();
  16. expect(comp.isOn).withContext('off at first').toBe(false);
  17. comp.clicked();
  18. expect(comp.isOn).withContext('on after click').toBe(true);
  19. comp.clicked();
  20. expect(comp.isOn).withContext('off after second click').toBe(false);
  21. });
  22. });