You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/05/01 22:57:38 UTC
[6/6] updated test project for jasmine tests
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/events/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/events/index.html b/tests/MobileSpecUnitTests/www/events/index.html
index 6ce3ae6..2c7e8ba 100644
--- a/tests/MobileSpecUnitTests/www/events/index.html
+++ b/tests/MobileSpecUnitTests/www/events/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
@@ -21,6 +21,18 @@
function interceptSearchbutton() {
eventOutput("Search button intercepted");
}
+ function interceptResume() {
+ eventOutput("Resume event intercepted");
+ }
+ function interceptPause() {
+ eventOutput("Pause event intercepted");
+ }
+ function interceptOnline() {
+ eventOutput("Online event intercepted");
+ }
+ function interceptOffline() {
+ eventOutput("Offline event intercepted");
+ }
var eventOutput = function(s) {
var el = document.getElementById("results");
@@ -42,11 +54,6 @@
alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
}
},1000);
- document.addEventListener("resume", function() {eventOutput("resume event");}, false);
- document.addEventListener("pause", function() {eventOutput("pause event");}, false);
- window.addEventListener("online", function() {eventOutput("online event");});
- window.addEventListener("offline", function() {eventOutput("offline event");});
-
}
</script>
@@ -67,6 +74,15 @@
<div class="btn large" onclick="document.removeEventListener('menubutton', interceptMenubutton, false);">Stop intercept of menubutton</div>
<div class="btn large" onclick="document.addEventListener('searchbutton', interceptSearchbutton, false);">Intercept searchbutton</div>
<div class="btn large" onclick="document.removeEventListener('searchbutton', interceptSearchbutton, false);">Stop intercept of searchbutton</div>
+ <div class="btn large" onclick="document.addEventListener('resume', interceptResume, false);">Intercept resume</div>
+ <div class="btn large" onclick="document.removeEventListener('resume', interceptResume, false);">Stop intercept of resume</div>
+ <div class="btn large" onclick="document.addEventListener('pause', interceptPause, false);">Intercept pause</div>
+ <div class="btn large" onclick="document.removeEventListener('pause', interceptPause, false);">Stop intercept of pause</div>
+ <div class="btn large" onclick="document.addEventListener('online', interceptOnline, false);">Intercept online</div>
+ <div class="btn large" onclick="document.removeEventListener('online', interceptOnline, false);">Stop intercept of online</div>
+ <div class="btn large" onclick="document.addEventListener('offline', interceptOffline, false);">Intercept offline</div>
+ <div class="btn large" onclick="document.removeEventListener('offline', interceptOffline, false);">Stop intercept of offline</div>
+
<h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
</body>
-</html>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/index.html b/tests/MobileSpecUnitTests/www/index.html
index 9bc5b52..d33dc5f 100644
--- a/tests/MobileSpecUnitTests/www/index.html
+++ b/tests/MobileSpecUnitTests/www/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script>
</head>
@@ -29,6 +29,7 @@
<a href="events/index.html" class="btn large">Events</a>
<a href="location/index.html" class="btn large">Location</a>
<a href="misc/index.html" class="btn large">Misc Content</a>
+ <a href="network/index.html" class="btn large">Network</a>
<a href="notification/index.html" class="btn large">Notification</a>
<a href="sql/index.html" class="btn large">Web SQL</a>
<a href="storage/index.html" class="btn large">Local Storage</a>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/location/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/location/index.html b/tests/MobileSpecUnitTests/www/location/index.html
index 438bfbb..e39c12e 100644
--- a/tests/MobileSpecUnitTests/www/location/index.html
+++ b/tests/MobileSpecUnitTests/www/location/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/misc/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/misc/index.html b/tests/MobileSpecUnitTests/www/misc/index.html
index ce47b74..697cb10 100644
--- a/tests/MobileSpecUnitTests/www/misc/index.html
+++ b/tests/MobileSpecUnitTests/www/misc/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
@@ -43,15 +43,9 @@
</div>
<h2>Action</h2>
<div class="btn large" onclick="document.location='tel:5551212';" >Call 411</div>
-<<<<<<< HEAD
<a href="mailto:bob@abc.org?subject=My Subject&body=This is the body.%0D%0ANew line." class="btn large">Send Mail</a>
<a href="sms:5125551234?body=The SMS message." class="btn large">Send SMS</a>
<a href="http://www.google.com" class="btn large">Load Web Site</a>
-=======
- <a href="mailto:bob@abc.org?subject=My Subject&body=This is the body.%0D%0ANew line." class="btn large">Send Mail</div>
- <a href="sms:5125551234?body=The SMS message." class="btn large">Send SMS</div>
- <a href="http://www.google.com" class="btn large">Load Web Site</div>
->>>>>>> fixed html errors, and various html tweaks, doctype, javascript:
<!-- Need new URL -->
<!-- a href="http://handle.library.cornell.edu/control/authBasic/authTest/" class="btn large">Basic Auth: test/this</a -->
<a href="page2.html" hrefbad="page2.html?me=test" class="btn large">Load another PhoneGap page</a>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/misc/page2.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/misc/page2.html b/tests/MobileSpecUnitTests/www/misc/page2.html
index c38e2c7..22026fc 100644
--- a/tests/MobileSpecUnitTests/www/misc/page2.html
+++ b/tests/MobileSpecUnitTests/www/misc/page2.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="../main.js"></script>
</head>
@@ -20,10 +20,6 @@
<h4>Width: <span id="width"> </span>, Height: <span id="height">
</span>, Color Depth: <span id="colorDepth"></span></h4>
</div>
-<<<<<<< HEAD
<div ><button class="backBtn" onclick="backHome();">Back</button></div>
-=======
- <div ><button onclick="history.back();">Back</button></div>
->>>>>>> fixed html errors, and various html tweaks, doctype, javascript:
</body>
</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/network/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/network/index.html b/tests/MobileSpecUnitTests/www/network/index.html
new file mode 100644
index 0000000..0b2204b
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/network/index.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+ <title>Cordova Mobile Spec</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+
+
+<script type="text/javascript" charset="utf-8">
+
+ var deviceReady = false;
+
+ var eventOutput = function(s) {
+ var el = document.getElementById("results");
+ el.innerHTML = el.innerHTML + s + "<br>";
+ };
+
+ function printNetwork() {
+ eventOutput("Current network connection type is: " + navigator.network.connection.type);
+ }
+
+ /**
+ * Function called when page has finished loading.
+ */
+ function init() {
+ document.addEventListener("deviceready", function() {
+ deviceReady = true;
+ console.log("Device="+device.platform+" "+device.version);
+ eventOutput("Network Connection is: " + navigator.network.connection.type);
+ document.addEventListener('online', function() { eventOutput('Online event, connection is: ' + navigator.network.connection.type); }, false);
+ document.addEventListener('offline', function() { eventOutput('Offline event, connection is: ' + navigator.network.connection.type); }, false);
+
+ }, false);
+ window.setTimeout(function() {
+ if (!deviceReady) {
+ alert("Error: Cordova did not initialize. Demo will not run correctly.");
+ }
+ },1000);
+ }
+
+</script>
+
+ </head>
+ <body onload="init();" id="stage" class="theme">
+
+ <h1>Network Events and State</h1>
+ <div id="info">
+ <b>Results:</b><br>
+ <span id="results"></span>
+ </div>
+
+ <h2>Action</h2>
+ <div class="btn large" onclick="printNetwork();">Show Network Connection</div>
+ <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+ </body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/notification/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/notification/index.html b/tests/MobileSpecUnitTests/www/notification/index.html
index ac8be10..e5c0d17 100644
--- a/tests/MobileSpecUnitTests/www/notification/index.html
+++ b/tests/MobileSpecUnitTests/www/notification/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
@@ -21,7 +21,7 @@
};
var vibrate = function(){
- navigator.notification.vibrate(0);
+ navigator.notification.vibrate(1000);
};
var alertDialog = function(message, title, button) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/phonegap.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/phonegap.js b/tests/MobileSpecUnitTests/www/phonegap.js
deleted file mode 100644
index bba5600..0000000
--- a/tests/MobileSpecUnitTests/www/phonegap.js
+++ /dev/null
@@ -1,13 +0,0 @@
-document.write('<script type="text/javascript" charset="utf-8" src="../../cordova-1.6.1.js"></script>');
-document.write('<script type="text/javascript" charset="utf-8" src="../cordova-1.6.1.js"></script>');
-document.write('<script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>');
-
-function backHome() {
-
- if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
- navigator.app.backHistory();
- }
- else {
- window.history.go(-1);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/sql/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/sql/index.html b/tests/MobileSpecUnitTests/www/sql/index.html
index cae19ce..116f8d1 100644
--- a/tests/MobileSpecUnitTests/www/sql/index.html
+++ b/tests/MobileSpecUnitTests/www/sql/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/storage/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/storage/index.html b/tests/MobileSpecUnitTests/www/storage/index.html
index d638a29..85a0dbd 100644
--- a/tests/MobileSpecUnitTests/www/storage/index.html
+++ b/tests/MobileSpecUnitTests/www/storage/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">