mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
30 lines
870 B
JavaScript
30 lines
870 B
JavaScript
var expect = require("chai").expect;
|
|
|
|
module.exports = function (helpers) {
|
|
var component = helpers.mount(require.resolve("./index"), {
|
|
name: "Frank",
|
|
count: 30,
|
|
});
|
|
|
|
var targetEl = component.el;
|
|
|
|
expect(targetEl.innerHTML).to.contain(
|
|
"Hello Frank! You have 30 new messages.",
|
|
);
|
|
expect(targetEl.innerHTML).to.contain("foo: bar");
|
|
expect(targetEl.innerHTML).to.contain("hello: world");
|
|
expect(component.state.name).to.equal("Frank");
|
|
expect(component.state.count).to.equal(30);
|
|
|
|
component.setState("name", "John");
|
|
component.update();
|
|
|
|
expect(targetEl.innerHTML).to.contain(
|
|
"Hello John! You have 30 new messages.",
|
|
);
|
|
expect(targetEl.innerHTML).to.contain("foo: bar");
|
|
expect(targetEl.innerHTML).to.contain("hello: world");
|
|
expect(component.state.name).to.equal("John");
|
|
expect(component.state.count).to.equal(30);
|
|
};
|