Add option for custom label to waitsForPromise

This commit is contained in:
Daniel Hengeveld
2016-01-14 20:47:02 -05:00
parent 411a80dab6
commit 4fff6221bd

View File

@@ -209,12 +209,13 @@ addCustomMatchers = (spec) ->
window.waitsForPromise = (args...) ->
if args.length > 1
{shouldReject, timeout} = args[0]
{shouldReject, timeout, label} = args[0]
else
label = 'promise to be resolved or rejected'
shouldReject = false
fn = _.last(args)
window.waitsFor timeout, (moveOn) ->
window.waitsFor label, timeout, (moveOn) ->
promise = fn()
if shouldReject
promise.catch.call(promise, moveOn)