cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [1/4] git commit: Changing some names around
Date Tue, 06 May 2014 19:20:47 GMT
Repository: cordova-labs
Updated Branches:
  refs/heads/cdvtest 599ebd16e -> 8ae8e0336


Changing some names around


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

Branch: refs/heads/cdvtest
Commit: 851130a464815b4e8705d225500cbcb7eecfafd7
Parents: 599ebd1
Author: Michal Mocny <mmocny@gmail.com>
Authored: Tue May 6 13:26:27 2014 -0400
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Tue May 6 13:26:27 2014 -0400

----------------------------------------------------------------------
 cordova-plugin-test-framework/plugin.xml   |   4 +-
 cordova-plugin-test-framework/www/main.js  |  12 +--
 cordova-plugin-test-framework/www/test.js  |  93 --------------------
 cordova-plugin-test-framework/www/tests.js | 108 ++++++++++++++++++++++++
 4 files changed, 116 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/851130a4/cordova-plugin-test-framework/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-plugin-test-framework/plugin.xml b/cordova-plugin-test-framework/plugin.xml
index 1a9a12d..3ce8692 100644
--- a/cordova-plugin-test-framework/plugin.xml
+++ b/cordova-plugin-test-framework/plugin.xml
@@ -12,10 +12,10 @@
 
     <!-- <dependency id="org.apache.cordova.appsettings" /> -->
 
-    <js-module src="www/test.js" name="test" />
+    <js-module src="www/tests.js" name="cdvtests" />
     <js-module src="www/jasmine_helpers.js" name="jasmine_helpers" />
     <js-module src="www/main.js" name="main" />
 
-    <asset src="www/assets" target="cdvtest" />
+    <asset src="www/assets" target="cdvtests" />
 
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/851130a4/cordova-plugin-test-framework/www/main.js
----------------------------------------------------------------------
diff --git a/cordova-plugin-test-framework/www/main.js b/cordova-plugin-test-framework/www/main.js
index 999ab68..54b1d64 100644
--- a/cordova-plugin-test-framework/www/main.js
+++ b/cordova-plugin-test-framework/www/main.js
@@ -26,7 +26,7 @@
 /******************************************************************************/
 
 function getMode(callback) {
-  var mode = localStorage.getItem('cdvtest-mode') || 'main';
+  var mode = localStorage.getItem('cdvtests-mode') || 'main';
   callback(mode);
 }
 
@@ -42,7 +42,7 @@ function setMode(mode) {
     mode = 'main';
   }
 
-  localStorage.setItem('cdvtest-mode', mode);
+  localStorage.setItem('cdvtests-mode', mode);
   clearContent();
 
   handlers[mode]();
@@ -112,8 +112,8 @@ function runAutoTests() {
   createActionButton('Reset App', location.reload.bind(location));
   createActionButton('Back', setMode.bind(null, 'main'));
 
-  var cdvtest = cordova.require('org.apache.cordova.test-framework.test');
-  cdvtest.defineAutoTests();
+  var cdvtests = cordova.require('org.apache.cordova.test-framework.cdvtests');
+  cdvtests.defineAutoTests();
 
   // Run the tests!
   var jasmineEnv = window.jasmine.getEnv();
@@ -135,8 +135,8 @@ function runManualTests() {
     createActionButton('Reset App', location.reload.bind(location));
     createActionButton('Back', setMode.bind(null, 'manual'));
   }
-  var cdvtest = cordova.require('org.apache.cordova.test-framework.test');
-  cdvtest.defineManualTests(contentEl, beforeEach, createActionButton);
+  var cdvtests = cordova.require('org.apache.cordova.test-framework.cdvtests');
+  cdvtests.defineManualTests(contentEl, beforeEach, createActionButton);
 }
 
 /******************************************************************************/

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/851130a4/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
deleted file mode 100644
index cb1fd1c..0000000
--- a/cordova-plugin-test-framework/www/test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-'use strict';
-
-exports.tests = Object.create(null);
-
-function getTestsObject(api) {
-  return exports.tests[api] = exports.tests[api] || { enabled: true };
-}
-
-exports.init = function() {
-  // Attach jasmineInterface to global object
-  var jasmine_helpers = require('./jasmine_helpers');
-  var jasmineInterface = jasmine_helpers.setUpJasmine();
-  for (var property in jasmineInterface) {
-    window[property] = jasmineInterface[property];
-  }
-
-  // This finds all js-modules named "tests" (regardless of plugins they came from)
-  var test_modules = cordova.require('cordova/plugin_list')
-    .map(function(jsmodule) {
-      return jsmodule.id;
-    })
-    .filter(function(id) {
-      return /.tests$/.test(id);
-    });
-
-  // Map auto / manual test definitions for each, but without actually running the handlers
-  test_modules.forEach(function(id) {
-    try {
-      var plugintests = cordova.require(id);
-
-      if (plugintests.hasOwnProperty('defineAutoTests')) {
-        getTestsObject(id).defineAutoTests = function() {
-          jasmineInterface.describe(id + ' >>', plugintests.defineAutoTests.bind(plugintests));
-        };
-      }
-
-      if (plugintests.hasOwnProperty('defineManualTests')) {
-        getTestsObject(id).defineManualTests = plugintests.defineManualTests.bind(plugintests);
-      }
-    } catch(ex) {
-      console.warn('Failed to load tests: ', id);
-      return;
-    }
-  });
-}
-
-exports.defineAutoTests = function() {
-  exports.init();
-
-  Object.keys(exports.tests).forEach(function(key) {
-    if (!exports.tests[key].enabled)
-      return;
-    if (!exports.tests[key].hasOwnProperty('defineAutoTests'))
-      return;
-    exports.tests[key].defineAutoTests();
-  });
-};
-
-exports.defineManualTests = function(contentEl, beforeEach, createActionButton) {
-  exports.init();
-
-  Object.keys(exports.tests).forEach(function(key) {
-    if (!exports.tests[key].enabled)
-      return;
-    if (!exports.tests[key].hasOwnProperty('defineManualTests'))
-      return;
-    createActionButton(key, function() {
-      beforeEach();
-      exports.tests[key].defineManualTests(contentEl, createActionButton);
-    });
-  });
-};

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/851130a4/cordova-plugin-test-framework/www/tests.js
----------------------------------------------------------------------
diff --git a/cordova-plugin-test-framework/www/tests.js b/cordova-plugin-test-framework/www/tests.js
new file mode 100644
index 0000000..1d20ba0
--- /dev/null
+++ b/cordova-plugin-test-framework/www/tests.js
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+'use strict';
+
+exports.tests = Object.create(null);
+
+function getTestsObject(api) {
+  return exports.tests[api] = exports.tests[api] || { enabled: true };
+}
+
+function requireAllTestModules() {
+  // This finds all js-modules named "tests" (regardless of plugins they came from)
+  var test_modules = cordova.require('cordova/plugin_list')
+    .map(function(jsmodule) {
+      return jsmodule.id;
+    })
+    .filter(function(id) {
+      return /.tests$/.test(id);
+    });
+
+  // Map auto / manual test definitions for each, but without actually running the handlers
+  test_modules.forEach(function(id) {
+    try {
+      var plugintests = cordova.require(id);
+
+      if (plugintests.hasOwnProperty('defineAutoTests')) {
+        getTestsObject(id).defineAutoTests = function() {
+          jasmineInterface.describe(id + ' >>', plugintests.defineAutoTests.bind(plugintests));
+        };
+      }
+
+      if (plugintests.hasOwnProperty('defineManualTests')) {
+        getTestsObject(id).defineManualTests = plugintests.defineManualTests.bind(plugintests);
+      }
+    } catch(ex) {
+      console.warn('Failed to load tests: ', id);
+      return;
+    }
+  });
+}
+
+function createJasmineInterface() {
+  var jasmine_helpers = require('./jasmine_helpers');
+  var jasmineInterface = jasmine_helpers.setUpJasmine();
+  return jasmineInterface;
+}
+
+function attachJasmineInterfaceToGlobal() {
+  var jasmineInterface = createJasmineInterface();
+  for (var property in jasmineInterface) {
+    window[property] = jasmineInterface[property];
+  }
+}
+
+function detachJasmineInterfaceFromGlobal() {
+  var jasmineInterface = createJasmineInterface();
+  for (var property in jasmineInterface) {
+    delete window[property];
+  }
+}
+
+exports.defineAutoTests = function() {
+  requireAllTestModules();
+  attachJasmineInterfaceToGlobal();
+
+  Object.keys(exports.tests).forEach(function(key) {
+    if (!exports.tests[key].enabled)
+      return;
+    if (!exports.tests[key].hasOwnProperty('defineAutoTests'))
+      return;
+    exports.tests[key].defineAutoTests();
+  });
+};
+
+exports.defineManualTests = function(contentEl, beforeEach, createActionButton) {
+  requireAllTestModules();
+  detachJasmineInterfaceFromGlobal();
+
+  Object.keys(exports.tests).forEach(function(key) {
+    if (!exports.tests[key].enabled)
+      return;
+    if (!exports.tests[key].hasOwnProperty('defineManualTests'))
+      return;
+    createActionButton(key, function() {
+      beforeEach();
+      exports.tests[key].defineManualTests(contentEl, createActionButton);
+    });
+  });
+};


Mime
View raw message