You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2012/03/28 18:34:14 UTC
[2/2] spec commit: Adding tests to check for legacy plugins API
Adding tests to check for legacy plugins API
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/79a84e59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/79a84e59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/79a84e59
Branch: refs/heads/master
Commit: 79a84e59383501f1cccb025e64e35e31d284aac4
Parents: 6bf737e
Author: macdonst <si...@gmail.com>
Authored: Wed Mar 28 12:33:32 2012 -0400
Committer: macdonst <si...@gmail.com>
Committed: Wed Mar 28 12:33:32 2012 -0400
----------------------------------------------------------------------
autotest/index.html | 1 +
autotest/pages/all.html | 1 +
autotest/pages/platform.html | 54 +++++++++++++++++++++++++++++++++
autotest/tests/platform.tests.js | 37 ++++++++++++++++++++++
4 files changed, 93 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/79a84e59/autotest/index.html
----------------------------------------------------------------------
diff --git a/autotest/index.html b/autotest/index.html
index b55425d..d143a94 100755
--- a/autotest/index.html
+++ b/autotest/index.html
@@ -25,6 +25,7 @@
<a href="pages/media.html" class="btn large" style="width:100%;">Run Media Tests</a>
<a href="pages/network.html" class="btn large" style="width:100%;">Run Network Tests</a>
<a href="pages/notification.html" class="btn large" style="width:100%;">Run Notification Tests</a>
+ <a href="pages/platform.html" class="btn large" style="width:100%;">Run Platform Tests</a>
<a href="pages/storage.html" class="btn large" style="width:100%;">Run Storage Tests</a>
<h2> </h2><a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/79a84e59/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/autotest/pages/all.html b/autotest/pages/all.html
index 81e9de3..fe1a119 100644
--- a/autotest/pages/all.html
+++ b/autotest/pages/all.html
@@ -29,6 +29,7 @@
<script type="text/javascript" src="../tests/media.tests.js"></script>
<script type="text/javascript" src="../tests/network.tests.js"></script>
<script type="text/javascript" src="../tests/notification.tests.js"></script>
+ <script type="text/javascript" src="../tests/platform.tests.js"></script>
<script type="text/javascript" src="../tests/storage.tests.js"></script>
<script type="text/javascript">
document.addEventListener('deviceready', function() {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/79a84e59/autotest/pages/platform.html
----------------------------------------------------------------------
diff --git a/autotest/pages/platform.html b/autotest/pages/platform.html
new file mode 100644
index 0000000..aa55885
--- /dev/null
+++ b/autotest/pages/platform.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
+ <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
+
+ <title>Cordova: Platform API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.js"></script>
+
+ <!-- Source -->
+ <script type="text/javascript" src="../../phonegap.js"></script>
+
+ <!-- Load Test Runner -->
+ <script type="text/javascript" src="../test-runner.js"></script>
+
+ <!-- Tests -->
+ <script type="text/javascript" src="../tests/platform.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+ <h1 id="qunit-header">Cordova: Platform API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/79a84e59/autotest/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/platform.tests.js b/autotest/tests/platform.tests.js
new file mode 100644
index 0000000..67fb28c
--- /dev/null
+++ b/autotest/tests/platform.tests.js
@@ -0,0 +1,37 @@
+Tests.prototype.PlatformTests = function() {
+ module('Platform (cordova)');
+ test("should exist", function() {
+ expect(1);
+ ok(typeof cordova != 'undefined' && cordova != null, "cordova should not be null.");
+ });
+ module('Platform (Cordova)');
+ test("should not exist", function() {
+ expect(1);
+ ok(typeof Cordova == 'undefined', "Cordova should be null.");
+ });
+ module('Platform (PhoneGap)');
+ test("should exist", function() {
+ expect(1);
+ ok(typeof PhoneGap != 'undefined' && PhoneGap != null, "PhoneGap should not be null.");
+ });
+ test("exec method should exist", function() {
+ expect(2);
+ ok(typeof PhoneGap.exec != 'undefined' && PhoneGap.exec != null, "PhoneGap.exec should not be null.");
+ ok(typeof PhoneGap.exec == 'function', "PhoneGap.exec should be a function.");
+ });
+ test("addPlugin method should exist", function() {
+ expect(2);
+ ok(typeof PhoneGap.addPlugin != 'undefined' && PhoneGap.addPlugin != null, "PhoneGap.addPlugin should not be null.");
+ ok(typeof PhoneGap.addPlugin == 'function', "PhoneGap.addPlugin should be a function.");
+ });
+ test("addConstructor method should exist", function() {
+ expect(2);
+ ok(typeof PhoneGap.addConstructor != 'undefined' && PhoneGap.addConstructor != null, "PhoneGap.addConstructor should not be null.");
+ ok(typeof PhoneGap.addConstructor == 'function', "PhoneGap.addConstructor should be a function.");
+ });
+ module('Platform (window.plugins)');
+ test("should exist", function() {
+ expect(1);
+ ok(typeof window.plugins != 'undefined' && window.plugins != null, "window.plugins should not be null.");
+ });
+};
\ No newline at end of file