Only call callback once

This commit is contained in:
Simon Kornblith 2011-07-18 21:37:38 +00:00
parent e7d5f31d04
commit ce1b3e099a

View file

@ -425,11 +425,12 @@ function haveTranslators(translators, type) {
/** /**
* Runs translator tests recursively, after translatorTestViews has been populated * Runs translator tests recursively, after translatorTestViews has been populated
*/ */
function runTranslatorTests(type, callback) { function runTranslatorTests(type, callback, runCallbackIfComplete) {
if(translatorTestViewsToRun[type].length) { if(translatorTestViewsToRun[type].length) {
if(translatorTestViewsToRun[type].length === 1) runCallbackIfComplete = true;
var translatorTestView = translatorTestViewsToRun[type].shift(); var translatorTestView = translatorTestViewsToRun[type].shift();
translatorTestView.runTests(function() { runTranslatorTests(type, callback) }); translatorTestView.runTests(function() { runTranslatorTests(type, callback, runCallbackIfComplete) });
} else if(callback) { } else if(callback && runCallbackIfComplete) {
callback(); callback();
} }
} }