From e4bf73b41c83037bf19ce971b262b744ecaeb861 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 1 Mar 2013 16:27:13 -0700 Subject: [PATCH] Give the view a chance to update before presenting next dialog --- spec/app/atom-spec.coffee | 2 ++ src/app/atom.coffee | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 675443a19..e614a2ff7 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -150,11 +150,13 @@ describe "the `atom` global", -> callbacks = @argsForCall[0][2] @reset() callbacks[labels.indexOf(buttonText)]() + advanceClock 50 atom.sendMessageToBrowserProcess.simulatePathSelection = (path) -> callback = @argsForCall[0][2] @reset() callback(path) + advanceClock 50 it "only presents one native dialog at a time", -> confirmHandler = jasmine.createSpy("confirmHandler") diff --git a/src/app/atom.coffee b/src/app/atom.coffee index 597fb60cb..2e4635c18 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -131,7 +131,8 @@ _.extend atom, @pendingModals.push([]) # prioritize any modals presented during dismiss callback fn?(args...) @presentingModal = false - @presentModal(fn) if fn = @shiftPendingModal() + if fn = @shiftPendingModal() + _.delay (=> @presentModal(fn)), 50 # let view update before next dialog pushPendingModal: (fn) -> # pendingModals is a stack of queues. enqueue to top of stack.