From 63208324402e885ae7cd5265d0da60a9bbb25c56 Mon Sep 17 00:00:00 2001 From: impinball Date: Mon, 24 Aug 2015 23:20:21 -0400 Subject: [PATCH] Fix a test to check the correct `this` --- tests/mithril-tests.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 05b6be20..f81fe856 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1381,11 +1381,14 @@ function testMithril(mock) { return value === "foo" }) test(function() { - var value - var _this - var handler = m.withAttr("test", function(data) {value = data}, _this) + var _this = {} + var value, context + var handler = m.withAttr("test", function(data) { + value = data; + context = this; + }, _this) handler({currentTarget: {test: "foo"}}) - return value === "foo" && handler.this === _this + return value === "foo" && context === _this }) //m.trust @@ -2591,7 +2594,7 @@ function testMithril(mock) { mock.requestAnimationFrame.$resolve() m.route("/test12", {a: "foo", b: "bar"}) mock.requestAnimationFrame.$resolve() - + var params = m.route.param(); var result = params.a === "foo" && params.b === "bar"