mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
28 lines
978 B
JavaScript
28 lines
978 B
JavaScript
var expect = require('chai').expect;
|
|
|
|
module.exports = function(helpers) {
|
|
var widget = helpers.mount(require('./index'), {});
|
|
|
|
var oldEl = widget.el;
|
|
|
|
var button1Widget = widget.getWidget('button1');
|
|
var button2Widget = widget.getWidget('button2');
|
|
|
|
expect(button1Widget.el.className).to.contain('small');
|
|
expect(button2Widget.el.className).to.contain('small');
|
|
|
|
expect(button1Widget.el.innerHTML).to.contain('Initial Label');
|
|
expect(button2Widget.el.innerHTML).to.contain('Initial Label');
|
|
|
|
widget.setState('buttonSize', 'large');
|
|
widget.setState('buttonLabel', 'New Label'); // buttonLabel does not have an update handler
|
|
widget.update();
|
|
|
|
expect(button1Widget.el.className).to.contain('large');
|
|
expect(button2Widget.el.className).to.contain('large');
|
|
|
|
expect(button1Widget.el.innerHTML).to.contain('New Label');
|
|
expect(button2Widget.el.innerHTML).to.contain('New Label');
|
|
|
|
expect(widget.el).to.equal(oldEl);
|
|
}; |