Fixed m.request initialValue tests
This commit is contained in:
parent
71a6321c46
commit
b5de0c2b4d
3 changed files with 143 additions and 75 deletions
|
|
@ -1688,11 +1688,14 @@ function testMithril(mock) {
|
|||
return xhr.$headers["Content-Type"] === undefined
|
||||
})
|
||||
test(function() {
|
||||
var prop = m.request({method: "POST", url: "test", default: "foo"})
|
||||
return prop() === "foo"
|
||||
var prop = m.request({method: "POST", url: "test", initialValue: "foo"})
|
||||
var initialValue = prop();
|
||||
mock.XMLHttpRequest.$instances.pop().onreadystatechange()
|
||||
|
||||
return initialValue === "foo"
|
||||
})
|
||||
test(function() {
|
||||
var prop = m.request({method: "POST", url: "test", default: "foo"}).then(function(value) {return "bar"})
|
||||
var prop = m.request({method: "POST", url: "test", initialValue: "foo"}).then(function(value) {return "bar"})
|
||||
mock.XMLHttpRequest.$instances.pop().onreadystatechange()
|
||||
return prop() === "bar"
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue