Merge branch 'rewrite' into array-isArray
This commit is contained in:
commit
aa72f87408
27 changed files with 1172 additions and 529 deletions
|
|
@ -18,7 +18,7 @@ module.exports = function($window, Promise) {
|
|||
var next = then.apply(promise, arguments)
|
||||
next.then(complete, function(e) {
|
||||
complete()
|
||||
throw e
|
||||
if (count === 0) throw e
|
||||
})
|
||||
return finalize(next)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<body>
|
||||
<script src="../../module/module.js"></script>
|
||||
<script src="../../ospec/ospec.js"></script>
|
||||
<script src="../../test-utils/callAsync.js"></script>
|
||||
<script src="../../querystring/parse.js"></script>
|
||||
<script src="../../test-utils/parseURL.js"></script>
|
||||
<script src="../../test-utils/callAsync.js"></script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var callAsync = require("../../test-utils/callAsync")
|
||||
var xhrMock = require("../../test-utils/xhrMock")
|
||||
var Request = require("../../request/request")
|
||||
var Promise = require("../../promise/promise")
|
||||
|
|
@ -336,7 +337,7 @@ o.spec("xhr", function() {
|
|||
}
|
||||
})
|
||||
var promise = xhr("/item", {background: true}).then(function() {})
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(complete.callCount).equals(0)
|
||||
done()
|
||||
|
|
@ -377,5 +378,31 @@ o.spec("xhr", function() {
|
|||
o(e.message).equals("error")
|
||||
}).then(done)
|
||||
})
|
||||
o("triggers all branched catches upon rejection", function(done) {
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 500, responseText: "error"}
|
||||
}
|
||||
})
|
||||
var request = xhr({method: "GET", url: "/item"})
|
||||
var then = o.spy()
|
||||
var catch1 = o.spy()
|
||||
var catch2 = o.spy()
|
||||
var catch3 = o.spy()
|
||||
|
||||
request.catch(catch1)
|
||||
request.then(then, catch2)
|
||||
request.then(then).catch(catch3)
|
||||
|
||||
callAsync(function() {
|
||||
callAsync(function() {
|
||||
o(catch1.callCount).equals(1)
|
||||
o(then.callCount).equals(0)
|
||||
o(catch2.callCount).equals(1)
|
||||
o(catch3.callCount).equals(1)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue