Merge pull request #454 from TheThing/next
propify: Fix chaining to return original m.prop
This commit is contained in:
commit
550fe9871a
2 changed files with 9 additions and 1 deletions
|
|
@ -743,7 +743,8 @@ var m = (function app(window, undefined) {
|
||||||
var prop = m.prop();
|
var prop = m.prop();
|
||||||
promise.then(prop);
|
promise.then(prop);
|
||||||
prop.then = function(resolve, reject) {
|
prop.then = function(resolve, reject) {
|
||||||
return propify(promise.then(resolve, reject))
|
promise = promise.then(resolve, reject).then(prop);
|
||||||
|
return prop;
|
||||||
};
|
};
|
||||||
return prop
|
return prop
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1836,6 +1836,13 @@ function testMithril(mock) {
|
||||||
xhr.onreadystatechange()
|
xhr.onreadystatechange()
|
||||||
return xhr.$headers["Content-Type"] === undefined
|
return xhr.$headers["Content-Type"] === undefined
|
||||||
})
|
})
|
||||||
|
test(function() {
|
||||||
|
var prop = m.request({method: "POST", url: "test", initialValue: "foo"}).then(function(data) { return data; })
|
||||||
|
var initialValue = prop();
|
||||||
|
mock.XMLHttpRequest.$instances.pop().onreadystatechange()
|
||||||
|
|
||||||
|
return initialValue === "foo"
|
||||||
|
})
|
||||||
test(function() {
|
test(function() {
|
||||||
var prop = m.request({method: "POST", url: "test", initialValue: "foo"})
|
var prop = m.request({method: "POST", url: "test", initialValue: "foo"})
|
||||||
var initialValue = prop();
|
var initialValue = prop();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue