X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fjs%2Fmkws-jasmine-run.js;h=72ea20679d8c328f85b16ef846f050ff698cf86e;hb=bceda32ec4c5aaed6ce3e244aedc0ee47292ef97;hp=f3364b66590efb4aa6b885c5501a97b9e65869b7;hpb=14c2dabff12b5b2d9c9d76dd0a5387ac921bc65c;p=mkws-moved-to-github.git diff --git a/test/js/mkws-jasmine-run.js b/test/js/mkws-jasmine-run.js index f3364b6..72ea206 100644 --- a/test/js/mkws-jasmine-run.js +++ b/test/js/mkws-jasmine-run.js @@ -1,27 +1,42 @@ - (function() { - var jasmineEnv = jasmine.getEnv(); - jasmineEnv.updateInterval = 1000; - - var htmlReporter = new jasmine.HtmlReporter(); - - jasmineEnv.addReporter(htmlReporter); - - jasmineEnv.specFilter = function(spec) { - return htmlReporter.specFilter(spec); - }; - - var currentWindowOnload = window.onload; - - window.onload = function() { - if (currentWindowOnload) { - currentWindowOnload(); - } - execJasmine(); - }; - - function execJasmine() { - jasmineEnv.execute(); - } - - })(); - +/* + * init and run jasmine + * + * a given delay starts the test N miliseconds later + */ + +function mkws_jasmine_init(delay) { + var currentWindowOnload = window.onload; + + window.onload = function () { + if (currentWindowOnload) { + currentWindowOnload(); + } + if (delay) { + setTimeout(function () { + execJasmine() + }, delay); + } else { + execJasmine(); + } + }; + + function execJasmine() { + + var jasmineEnv = jasmine.getEnv(); + jasmineEnv.updateInterval = 1000; + var htmlReporter = new jasmine.HtmlReporter(); + jasmineEnv.addReporter(htmlReporter); + + jasmineEnv.specFilter = function (spec) { + return htmlReporter.specFilter(spec); + }; + + jasmineEnv.execute(); + } +}; + +mkws.$(document).ready(function () { + mkws_jasmine_init(0); +}); + +/* EOF */