check store nullity in m.prop

This commit is contained in:
Juan Manuel Ventura 2014-08-22 01:18:36 +02:00
parent f803da2008
commit fd7b3e0803
2 changed files with 5 additions and 1 deletions

View file

@ -393,7 +393,7 @@ Mithril = m = new function app(window, undefined) {
}
m.prop = function (store) {
if ((typeof store === 'object' || typeof store === 'function') &&
if ((typeof store === 'object' || typeof store === 'function') && store !== null &&
typeof store.then === 'function') {
var prop = _prop()
newPromisedProp(prop, store).then(prop)

View file

@ -1508,6 +1508,10 @@ function testMithril(mock) {
return prop() === "test2"
})
test(function() {
var prop = m.prop(null)
return prop() === null
})
//m.request
test(function() {