You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/02/09 02:54:38 UTC

spec commit: CB-3971 Break vibrations tests out from notification

Updated Branches:
  refs/heads/master 9d9b517f3 -> b4e5646d6


CB-3971 Break vibrations tests out from notification

- won't break existing platforms where code is not yet separated
- breaks out the vibrations from the notifications so they may be tested separately.


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/b4e5646d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/b4e5646d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/b4e5646d

Branch: refs/heads/master
Commit: b4e5646d621ddb7bee8b02c2c04fabf6ad1b5986
Parents: 9d9b517
Author: ldeluca <ld...@us.ibm.com>
Authored: Tue Jun 25 10:56:17 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Sat Feb 8 20:53:54 2014 -0500

----------------------------------------------------------------------
 autotest/index.html                  |  1 +
 autotest/pages/vibration.html        | 71 +++++++++++++++++++++++++++++
 autotest/tests/notification.tests.js |  5 ---
 autotest/tests/vibration.tests.js    | 31 +++++++++++++
 index.html                           |  1 +
 notification/index.html              |  5 ---
 vibration/index.html                 | 74 +++++++++++++++++++++++++++++++
 7 files changed, 178 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/autotest/index.html
----------------------------------------------------------------------
diff --git a/autotest/index.html b/autotest/index.html
index f75cebc..a699870 100644
--- a/autotest/index.html
+++ b/autotest/index.html
@@ -56,6 +56,7 @@
     <a href="pages/splashscreen.html" class="btn large" style="width:100%;">Run Splashscreen Tests</a>
     <a href="pages/whitelist.html" class="btn large" style="width:100%;">Run Whitelist Tests</a>
     <a href="pages/localXHR.html" class="btn large" style="width:100%;">Run local XHR Tests</a>
+    <a href="pages/vibration.html" class="btn large" style="width:100%;">Run Vibration Tests</a>
     <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/autotest/pages/vibration.html
----------------------------------------------------------------------
diff --git a/autotest/pages/vibration.html b/autotest/pages/vibration.html
new file mode 100644
index 0000000..b6bd03f
--- /dev/null
+++ b/autotest/pages/vibration.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<!--
+
+ 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.
+
+-->
+
+
+<html>
+
+<head>
+  <title>Cordova: Vibration API Specs</title>
+
+  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
+  <!-- Load jasmine -->
+  <link href="../jasmine.css" rel="stylesheet"/>
+  <script type="text/javascript" src="../jasmine.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporter.js"></script>
+  <script type="text/javascript" src="../html/ReporterView.js"></script>
+  <script type="text/javascript" src="../html/SpecView.js"></script>
+  <script type="text/javascript" src="../html/SuiteView.js"></script>
+  <script type="text/javascript" src="../html/TrivialReporter.js"></script>
+
+  <!-- Source -->
+  <script type="text/javascript" src="../../cordova-incl.js"></script>
+
+  <!-- Load Test Runner -->
+  <script type="text/javascript" src="../test-runner.js"></script>
+
+  <!-- Tests -->
+  <script type="text/javascript" src="../tests/vibration.tests.js"></script>
+
+  <script type="text/javascript">
+    document.addEventListener('deviceready', function () {
+      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();
+    }, false);
+  </script>
+</head>
+
+<body>
+  <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+</body>
+</html>
+

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/autotest/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/notification.tests.js b/autotest/tests/notification.tests.js
index 6b9f242..016bcfb 100644
--- a/autotest/tests/notification.tests.js
+++ b/autotest/tests/notification.tests.js
@@ -24,11 +24,6 @@ describe('Notification (navigator.notification)', function () {
                 expect(navigator.notification).toBeDefined();
 	});
 
-	it("should contain a vibrate function", function() {
-		expect(typeof navigator.notification.vibrate).toBeDefined();
-		expect(typeof navigator.notification.vibrate).toBe("function");
-	});
-
 	it("should contain a beep function", function() {
 		expect(typeof navigator.notification.beep).toBeDefined();
 		expect(typeof navigator.notification.beep).toBe("function");

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/autotest/tests/vibration.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/vibration.tests.js b/autotest/tests/vibration.tests.js
new file mode 100644
index 0000000..18e75f2
--- /dev/null
+++ b/autotest/tests/vibration.tests.js
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+describe('Vibration (navigator.notification.vibrate)', function () {
+	it("navigator.notification should exist", function() {
+                expect(navigator.notification).toBeDefined();
+	});
+
+	it("should contain a vibrate function", function() {
+		expect(typeof navigator.notification.vibrate).toBeDefined();
+		expect(typeof navigator.notification.vibrate).toBe("function");
+	});
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/index.html
----------------------------------------------------------------------
diff --git a/index.html b/index.html
index d9f2957..199e05b 100644
--- a/index.html
+++ b/index.html
@@ -63,5 +63,6 @@
     <a href="benchmarks/index.html" class="btn large">Benchmarks</a>
     <a href="inappbrowser/index.html" class="btn large">In App Browser</a>
     <a href="keyboard/index.html" class="btn large">Keyboard</a>
+    <a href="vibration/index.html" class="btn large">Vibration</a>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/notification/index.html
----------------------------------------------------------------------
diff --git a/notification/index.html b/notification/index.html
index bacc086..16aad7d 100644
--- a/notification/index.html
+++ b/notification/index.html
@@ -42,10 +42,6 @@
         navigator.notification.beep(3);
     };
 
-    var vibrate = function(){
-      navigator.notification.vibrate(1000);
-    };
-
     var alertDialog = function(message, title, button) {
         console.log("alertDialog()");
         navigator.notification.alert(message,
@@ -130,7 +126,6 @@
     
     <h2>Action</h2>
     <div class="btn large" onclick="beep();">Beep</div>
-    <div class="btn large" onclick="vibrate();">Vibrate</div>
     <div class="btn large" onclick="alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');">Alert Dialog</div>
     <div class="btn large" onclick="confirmDialogA('You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe');">Confirm Dialog - Deprecated</div>
     <div class="btn large" onclick="confirmDialogB('You pressed confirm.', 'Confirm Dialog', ['Yes', 'No', 'Maybe, Not Sure']);">Confirm Dialog</div>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/b4e5646d/vibration/index.html
----------------------------------------------------------------------
diff --git a/vibration/index.html b/vibration/index.html
new file mode 100644
index 0000000..ef9b76e
--- /dev/null
+++ b/vibration/index.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<!--
+
+ 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.
+
+-->
+
+
+<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-incl.js"></script>      
+
+      
+<script type="text/javascript" charset="utf-8">
+
+    var deviceReady = false;
+
+    //-------------------------------------------------------------------------
+    // Vibrations
+    //-------------------------------------------------------------------------
+
+    var vibrate = function(){
+      navigator.notification.vibrate(2500);
+    };
+
+    
+    /**
+     * Function called when page has finished loading.
+     */
+    function init() {
+        document.addEventListener("deviceready", function() {
+                deviceReady = true;
+                console.log("Device="+device.platform+" "+device.version);
+            }, false);
+        window.setTimeout(function() {
+            if (!deviceReady) {
+                alert("Error: Apache Cordova did not initialize.  Demo will not run correctly.");
+            }
+        },1000);
+    }
+
+</script>
+
+  </head>
+  <body onload="init();" id="stage" class="theme">
+  
+    <h1>Vibrations</h1>
+    <div id="info">
+    </div>
+    
+    <h2>Action</h2>
+    <div class="btn large" onclick="vibrate();">Vibrate</div>
+    <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
+  </body>
+</html>