cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [3/4] git commit: Updating the way we create jasmineInterface
Date Fri, 13 Dec 2013 16:02:44 GMT
Updating the way we create jasmineInterface


Project: http://git-wip-us.apache.org/repos/asf/cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-labs/commit/42e92abd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-labs/tree/42e92abd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-labs/diff/42e92abd

Branch: refs/heads/cdvtest
Commit: 42e92abdb54da05a7a46c3c63bcfbd90d17bb394
Parents: 52ff719
Author: Michal Mocny <mmocny@gmail.com>
Authored: Fri Dec 6 14:38:23 2013 -0500
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Fri Dec 13 09:59:34 2013 -0500

----------------------------------------------------------------------
 cordova-plugin-test-framework/www/test.js | 75 ++++++++------------------
 1 file changed, 23 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/42e92abd/cordova-plugin-test-framework/www/test.js
----------------------------------------------------------------------
diff --git a/cordova-plugin-test-framework/www/test.js b/cordova-plugin-test-framework/www/test.js
index 56bc407..68b3108 100644
--- a/cordova-plugin-test-framework/www/test.js
+++ b/cordova-plugin-test-framework/www/test.js
@@ -50,63 +50,34 @@ Object.defineProperty(exports, "log", {
 (function() {
 
 var jasmine,
-    jasmineEnv,
     jasmineInterface;
 
 /******************************************************************************/
 
 exports.initForAutoTests = function(jasmine_) {
   jasmine = jasmine_;
-  jasmineEnv = jasmine.getEnv();
-  jasmineInterface = {
-    describe: function(description, specDefinitions) {
-      return jasmineEnv.describe(description, specDefinitions);
-    },
-
-    xdescribe: function(description, specDefinitions) {
-      return jasmineEnv.xdescribe(description, specDefinitions);
-    },
-
-    it: function(desc, func) {
-      return jasmineEnv.it(desc, func);
-    },
-
-    xit: function(desc, func) {
-      return jasmineEnv.xit(desc, func);
-    },
-
-    beforeEach: function(beforeEachFunction) {
-      return jasmineEnv.beforeEach(beforeEachFunction);
-    },
-
-    afterEach: function(afterEachFunction) {
-      return jasmineEnv.afterEach(afterEachFunction);
-    },
-
-    expect: function(actual) {
-      return jasmineEnv.expect(actual);
-    },
-
-    pending: function() {
-      return jasmineEnv.pending();
-    },
-
-    addMatchers: function(matchers) {
-      return jasmineEnv.addMatchers(matchers);
-    },
-
-    spyOn: function(obj, methodName) {
-      return jasmineEnv.spyOn(obj, methodName);
-    },
-
-    clock: jasmineEnv.clock,
-
-    jsApiReporter: new jasmine.JsApiReporter({
-      timer: new jasmine.Timer()
-    }),
-
-    jasmine: jasmine,
-  };
+  jasmineInterface = {};
+
+  var jasmineEnv = jasmine.getEnv();
+
+  // Fill in jasmineInterface
+  var jasmine_functions = ['describe',
+                           'xdescribe',
+                           'it',
+                           'xit',
+                           'beforeEach',
+                           'afterEach',
+                           'expect',
+                           'pending',
+                           'addMatchers',
+                           'spyOn'];
+  jasmine_functions.forEach(function(fn) {
+    jasmineInterface[fn] = jasmineEnv[fn].bind(jasmineEnv);
+  });
+  jasmineInterface.clock = jasmineEnv.clock;
+  jasmineInterface.jsApiReporter = new jasmine.JsApiReporter({ timer: new jasmine.Timer()
});
+  jasmineInterface.jasmine = jasmine;
+  jasmineInterface.log = exports.log;
 
   jasmineEnv.addReporter(jasmineInterface.jsApiReporter);
 };
@@ -114,7 +85,7 @@ exports.initForAutoTests = function(jasmine_) {
 /******************************************************************************/
 
 exports.runAutoTests = function() {
-  jasmineEnv.execute();
+  jasmine.getEnv().execute();
 };
 
 /******************************************************************************/


Mime
View raw message