From 839f345fa3987335545cc170fcd7115ac5298197 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 8 Jul 2013 00:03:53 -0700 Subject: [PATCH] Cleanup web worker unit test. Former-commit-id: a6b2f450f26eba8cb233cceb5920e7ee69c665f1 --- test/test.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index 20e3a1c63..4e5561044 100644 --- a/test/test.js +++ b/test/test.js @@ -176,18 +176,19 @@ asyncTest('supports loading ' + basename + ' in a web worker', function() { if (Worker) { var limit = 1000, - start = new Date, - wait = 16; + start = new Date; - setTimeout(function attempt() { + var attempt = function() { var actual = _._VERSION; if ((new Date - start) < limit && typeof actual != 'string') { - setTimeout(attempt, wait); - } else { - equal(actual, _.VERSION); - QUnit.start(); + setTimeout(attempt, 16); + return; } - }, wait); + equal(actual, _.VERSION); + QUnit.start(); + }; + + attempt(); } else { skipTest(); QUnit.start();