Fix a test to check the correct this
This commit is contained in:
parent
d3cbbef4d5
commit
6320832440
1 changed files with 8 additions and 5 deletions
|
|
@ -1381,11 +1381,14 @@ function testMithril(mock) {
|
||||||
return value === "foo"
|
return value === "foo"
|
||||||
})
|
})
|
||||||
test(function() {
|
test(function() {
|
||||||
var value
|
var _this = {}
|
||||||
var _this
|
var value, context
|
||||||
var handler = m.withAttr("test", function(data) {value = data}, _this)
|
var handler = m.withAttr("test", function(data) {
|
||||||
|
value = data;
|
||||||
|
context = this;
|
||||||
|
}, _this)
|
||||||
handler({currentTarget: {test: "foo"}})
|
handler({currentTarget: {test: "foo"}})
|
||||||
return value === "foo" && handler.this === _this
|
return value === "foo" && context === _this
|
||||||
})
|
})
|
||||||
|
|
||||||
//m.trust
|
//m.trust
|
||||||
|
|
@ -2591,7 +2594,7 @@ function testMithril(mock) {
|
||||||
mock.requestAnimationFrame.$resolve()
|
mock.requestAnimationFrame.$resolve()
|
||||||
m.route("/test12", {a: "foo", b: "bar"})
|
m.route("/test12", {a: "foo", b: "bar"})
|
||||||
mock.requestAnimationFrame.$resolve()
|
mock.requestAnimationFrame.$resolve()
|
||||||
|
|
||||||
var params = m.route.param();
|
var params = m.route.param();
|
||||||
|
|
||||||
var result = params.a === "foo" && params.b === "bar"
|
var result = params.a === "foo" && params.b === "bar"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue