Added more tests for config context

This commit is contained in:
Sergey Kirillov 2014-05-31 18:49:04 +03:00
parent 5a2d7fdf81
commit 164e5b178c

View file

@ -936,6 +936,26 @@ function testMithril(mock) {
m.render(root, m("div", {config: function(elem, isInitialized, ctx) {success = ctx.data===1}}));
return success;
})
// more complex config context
test(function() {
var root = mock.document.createElement("div")
var idx = 0;
var success = true;
var statefulConfig = function(elem, isInitialized, ctx) {ctx.data=idx++}
var node = m("div", {config: statefulConfig});
m.render(root, [node, node]);
idx = 0;
var checkConfig = function(elem, isInitialized, ctx) {
success = success && (ctx.data === idx++)
}
node = m("div", {config: statefulConfig});
m.render(root, [node, node]);
return success;
})
}
//mocks