Tests

You can use any tool for testing you want. There is almost nothing really special to know. Below is an example with mocha + chai.

import { assert } from 'chai';
import Akili from 'akili';

class MyComponent extends Akili {
  created() {
    this.scope.example = 'Hello';
  }
}

let myComponentEl = document.createElement('my-component');

myComponentEl.innerHTML = '${ this.example }';
document.body.appendChild(myComponentEl);
Akili.component('my-component',  MyComponent);

describe('Application initialization', () => {
  before(() => Akili.init());

  describe('Test MyComponent', () => {
    let component;

    before(() => {
      component = myComponentEl.__akili; // or Akili.root.child('my-component');
    });

    it('the expression in the template should be parsed', () => {
      assert.equal(myComponentEl.innerHTML, 'Hello');
    });

    it('the value in the template should be changed ', () => {
      component.scope.example = 'Goodbye';
      assert.equal(myComponentEl.innerHTML, 'Goodbye');
    });
  });
});

You have at least two ways to get the component anywhere you want:

If you need to compile some component after the framework initialization use Akili.compile().