Fix another m.withAttr test
This commit is contained in:
parent
6320832440
commit
46775ce828
1 changed files with 17 additions and 11 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue