From 352d093d90857c064e485beb33b6904bc0eeec1f Mon Sep 17 00:00:00 2001 From: pelonpelon Date: Sat, 1 Aug 2015 15:01:38 -0500 Subject: [PATCH] test for correct `this` on m.withAttr callback --- tests/mithril-tests.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 36c50785..f1597309 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1380,6 +1380,13 @@ function testMithril(mock) { handler({currentTarget: {test: "foo"}}) return value === "foo" }) + test(function() { + var value + var _this + var handler = m.withAttr("test", function(data) {value = data}, _this) + handler({currentTarget: {test: "foo"}}) + return value === "foo" && handler.this === _this + }) //m.trust test(function() {return m.trust("test").valueOf() === "test"})