Fix another m.withAttr test

This commit is contained in:
impinball 2015-08-24 23:26:06 -04:00
parent 6320832440
commit 46775ce828

View file

@ -1375,20 +1375,26 @@ function testMithril(mock) {
//m.withAttr //m.withAttr
test(function() { test(function() {
var value //the handler is called with the correct value & context when callbackThis not given
var handler = m.withAttr("test", function(data) {value = data}) var _this = {};
handler({currentTarget: {test: "foo"}}) var value, context;
return value === "foo"
})
test(function() {
var _this = {}
var value, context
var handler = m.withAttr("test", function(data) { var handler = m.withAttr("test", function(data) {
value = data; value = data;
context = this; context = this;
}, _this) });
handler({currentTarget: {test: "foo"}}) handler.call(_this, {currentTarget: {test: "foo"}});
return value === "foo" && context === _this return value === "foo" && context === _this;
})
test(function() {
//the handler is called with the correct value & context when callbackThis is given
var _this = {};
var value, context;
var handler = m.withAttr("test", function(data) {
value = data;
context = this;
}, _this);
handler({currentTarget: {test: "foo"}});
return value === "foo" && context === _this;
}) })
//m.trust //m.trust