init and run jasmine
authorWolfram Schneider <wosch@indexdata.dk>
Tue, 20 Aug 2013 15:42:21 +0000 (17:42 +0200)
committerWolfram Schneider <wosch@indexdata.dk>
Tue, 20 Aug 2013 15:42:21 +0000 (17:42 +0200)
test/js/mkws-jasmine-run.js

index f3364b6..3b9b29e 100644 (file)
@@ -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 */