diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 3a24b1fa..3b33a72e 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -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