Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use waitsFor instead of setTimeout

  • Loading branch information...
commit 4ff31f032697ee009273d2c1b7f6775c3b8cb13a 1 parent a1aa628
@ConradIrwin ConradIrwin authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 spec/javascripts/lib/underscore_extensions_spec.js
View
13 spec/javascripts/lib/underscore_extensions_spec.js
@@ -149,16 +149,17 @@ describe("_.", function () {
_.deferInSequence([first, second, third]);
expect(a).toBe(0); // they should run deferred
- window.setTimeout(function () {
- expect(a).toBe(60);
- }, 10); // arbitrary longish delay
+ waitsFor(function () {
+ return a === 60;
+ }, "sequence did not complete");
});
it("should run the sequence in the correct order", function () {
_.deferInSequence([second, first, third]);
- window.setTimeout(function () {
- expect(a).toBe(20);
- }, 10); // arbitrary longish delay
+
+ waitsFor(function () {
+ return a === 20;
+ }, "sequence did not complete");
});
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.