Merge pull request #454 from TheThing/next

propify: Fix chaining to return original m.prop
This commit is contained in:
Leo Horie 2015-02-18 22:20:42 -05:00
commit 550fe9871a
2 changed files with 9 additions and 1 deletions

View file

@ -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
} }

View file

@ -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();