Merge pull request #5228 from atom/bo-fix-wait-promise

Make waitsForPromise() work with es6 promises as well as Q promises
This commit is contained in:
Ben Ogle 2015-01-23 10:33:20 -08:00
commit db41b022c2

View File

@ -303,13 +303,13 @@ window.waitsForPromise = (args...) ->
window.waitsFor timeout, (moveOn) ->
promise = fn()
if shouldReject
promise.fail(moveOn)
promise.done ->
promise.catch(moveOn)
promise.then ->
jasmine.getEnv().currentSpec.fail("Expected promise to be rejected, but it was resolved")
moveOn()
else
promise.done(moveOn)
promise.fail (error) ->
promise.then(moveOn)
promise.catch (error) ->
jasmine.getEnv().currentSpec.fail("Expected promise to be resolved, but it was rejected with #{jasmine.pp(error)}")
moveOn()