From: Wolfram Schneider Date: Tue, 20 Aug 2013 15:42:21 +0000 (+0200) Subject: init and run jasmine X-Git-Tag: 0.9.1~202^2~121 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=d512a156cbdffb79d59e70e1b20cdf34e05a4f7b;p=mkws-moved-to-github.git init and run jasmine --- diff --git a/test/js/mkws-jasmine-run.js b/test/js/mkws-jasmine-run.js index f3364b6..3b9b29e 100644 --- a/test/js/mkws-jasmine-run.js +++ b/test/js/mkws-jasmine-run.js @@ -1,27 +1,39 @@ - (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(); + } +}; + +/* EOF */