From 79036f60bc37fc565c734a57048b9b006bd3d242 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Mon, 19 Nov 2012 16:50:07 -0700 Subject: [PATCH] Fix bug when setTimeout is called from within a timeout in specs --- spec/spec-helper.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index a1882cdcd..885a63aa7 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -136,13 +136,17 @@ window.fakeClearTimeout = (idToClear) -> window.advanceClock = (delta=1) -> window.now += delta + callbacks = [] + window.timeouts = window.timeouts.filter ([id, strikeTime, callback]) -> if strikeTime <= window.now - callback() + callbacks.push(callback) false else true + callback() for callback in callbacks + window.pagePixelPositionForPoint = (editor, point) -> point = Point.fromObject point top = editor.renderedLines.offset().top + point.row * editor.lineHeight