mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
27 lines
895 B
JavaScript
27 lines
895 B
JavaScript
var expect = require("chai").expect;
|
|
|
|
module.exports = function (helpers) {
|
|
var component = helpers.mount(require.resolve("./index"), {});
|
|
var children = component.getEl("root").children;
|
|
expect(children.length).to.equal(2);
|
|
|
|
expect(children[0].getAttribute("data-foo")).to.equal("true");
|
|
expect(children[0].getAttribute("data-bar")).to.equal(null);
|
|
|
|
expect(children[1].getAttribute("data-foo")).to.equal(null);
|
|
expect(children[1].getAttribute("data-bar")).to.equal("true");
|
|
|
|
component.state.swapped = true;
|
|
component.update();
|
|
|
|
children = component.getEl("root").children;
|
|
|
|
expect(children.length).to.equal(2);
|
|
|
|
expect(children[0].getAttribute("data-foo")).to.equal(null);
|
|
expect(children[0].getAttribute("data-bar")).to.equal("true");
|
|
|
|
expect(children[1].getAttribute("data-foo")).to.equal("true");
|
|
expect(children[1].getAttribute("data-bar")).to.equal(null);
|
|
};
|