O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing component life cycle

We need to ensure that our data is retrieved as expected, and the same way, we need to assert that our component behavior is going well too. To do this, we can tell the component we created that we will manually handle the life cycle methods; you will find the code very self-explanatory:

import {StageComponent} from 'aurelia-testing';import {bootstrap} from 'aurelia-bootstrapper';describe('CustomerComponent', () => {  let component;  beforeEach(() => {    component = StageComponent      .withResources('src/customer-component')      .inView('<customer-component cust-name.bind="custName"></customer-component>')      .boundTo({ custName: 'Diego' });  });  it('can manually handle life cycle', done => {    let nameElement;    component.manuallyHandleLifecycle(). ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required