Bootstrapping the component

We will need to create the component so that Jasmine will use it to apply the test. Apply the following changes in the info-box.spec.js file:

 import {StageComponent} from 'aurelia-testing';
import {bootstrap} from 'aurelia-bootstrapper';

describe('Info-Box', () => {

it('should render the username and topic', done => {

let component = StageComponent
.withResources('info-box')
.inView('<info-box></info-box>');

component
.create(bootstrap);

});

});

Before we bootstrap the component, it has to be created. We use the StageComponent object to instantiate an Aurelia component; we specify the component by passing its name as a param of the withResources function. Lastly, we specify a view using the <info-box> element in the inView function.

Once we have the component skeleton defined, we call its create function and pass the bootstrap object. The bootstrap object contains the default configuration specified in the main.js file, as discussed in Chapter 1, Introducing Aurelia.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset