mirror of
https://github.com/marko-js/marko.git
synced 2026-01-25 15:03:04 +00:00
21 lines
724 B
JavaScript
21 lines
724 B
JavaScript
var expect = require('chai').expect;
|
|
|
|
module.exports = function (helpers) {
|
|
var component = helpers.mount(require('./index'), {});
|
|
var rootEl = component.el;
|
|
var helloCountEl = rootEl.querySelector('span.hello-count');
|
|
var helloComponent = component.getComponent('hello');
|
|
|
|
component.state.count = 1;
|
|
component.update();
|
|
|
|
expect(component.el).to.equal(rootEl);
|
|
expect(rootEl.querySelector('span.hello-count').innerHTML).to.equal('1');
|
|
expect(rootEl.querySelector('span.hello-count')).to.equal(helloCountEl);
|
|
|
|
component.state.renderHello = false;
|
|
component.update();
|
|
|
|
expect(helloComponent.isDestroyed()).to.equal(true);
|
|
expect(helloComponent.el == null).to.equal(true);
|
|
}; |