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/07/14 22:32:02 UTC

spec commit: Add statusbar manual test

Repository: cordova-mobile-spec
Updated Branches:
  refs/heads/master 12a941512 -> 290a435e1


Add statusbar manual test


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/290a435e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/290a435e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/290a435e

Branch: refs/heads/master
Commit: 290a435e11300822de0fbbe1a2d370cf4a1b6806
Parents: 12a9415
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Jul 14 16:31:50 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Jul 14 16:31:50 2014 -0400

----------------------------------------------------------------------
 www/index.html           | 18 +++++++-------
 www/master.css           |  1 +
 www/statusbar/index.html | 48 +++++++++++++++++++++++++++++++++++++
 www/statusbar/index.js   | 56 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/290a435e/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index fa014b2..8c02b93 100644
--- a/www/index.html
+++ b/www/index.html
@@ -33,16 +33,13 @@
   </head>
   <body id="stage" class="theme">
     <h1>Apache Cordova Tests</h1>
-    <div id="info">
-        <h4>cordova.version: <span id="cordova"> </span></h4>
-        <h4>Platform: <span id="platform">  </span></h4>
-        <h4>Version: <span id="version"> </span></h4>
-        <h4>UUID: <span id="uuid">  </span></h4>
-        <h4>Model: <span id="model"> </span></h4>
-        <h4>Width: <span id="width">  </span>,   Height: <span id="height">
-                   </span>, Color Depth: <span id="colorDepth"></span></h4>
-        <h4>User-Agent: <span id="user-agent"> </span></h4>
-     </div>
+<div id="info">cordova.version: <span id="cordova"> </span>
+Platform: <span id="platform">  </span>
+Version: <span id="version"> </span>
+UUID: <span id="uuid">  </span>
+Model: <span id="model"> </span>
+Width: <span id="width">  </span>,   Height: <span id="height"></span>, Color Depth: <span id="colorDepth"></span>
+User-Agent: <span id="user-agent"> </span></div>
     <a href="cdvtests/index.html?showBack" class="btn large">New-Style Tests</a>
     <a href="autotest/index.html" class="btn large">Automatic Test</a>
     <a href="accelerometer/index.html" class="btn large">Accelerometer</a>
@@ -66,5 +63,6 @@
     <a href="keyboard/index.html" class="btn large">Keyboard</a>
     <a href="vibration/index.html" class="btn large">Vibration</a>
     <a href="file/index.html" class="btn large">File &amp; File Transfer</a>
+    <a href="statusbar/index.html" class="btn large">Status Bar</a>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/290a435e/www/master.css
----------------------------------------------------------------------
diff --git a/www/master.css b/www/master.css
index 8c2b232..9e8798d 100644
--- a/www/master.css
+++ b/www/master.css
@@ -39,6 +39,7 @@
     min-width:295px;
     max-width:97%;
     padding:4px 0px 2px 10px;
+    white-space: pre-wrap;
     word-wrap:break-word;
     margin-bottom:10px;
     display:inline-block;

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/290a435e/www/statusbar/index.html
----------------------------------------------------------------------
diff --git a/www/statusbar/index.html b/www/statusbar/index.html
new file mode 100644
index 0000000..620db22
--- /dev/null
+++ b/www/statusbar/index.html
@@ -0,0 +1,48 @@
+<!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" src="./index.js"></script>
+  </head>
+  <body id="stage" class="theme">
+
+    <h1>Status Bar</h1>
+    <div id="info">
+    </div>
+
+    <h2>Action</h2>
+    Also: tapping bar on iOS should emit a log.
+    <div class="btn large action-show">show</div>
+    <div class="btn large action-hide">hide</div>
+    <div class="btn large action-color1">style=default</div>
+    <div class="btn large action-color2">style=red</div>
+    <div class="btn large action-overlays">Toggle Overlays</div>
+    <h2> </h2><div class="backBtn">Back</div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/290a435e/www/statusbar/index.js
----------------------------------------------------------------------
diff --git a/www/statusbar/index.js b/www/statusbar/index.js
new file mode 100644
index 0000000..dae733a
--- /dev/null
+++ b/www/statusbar/index.js
@@ -0,0 +1,56 @@
+
+function log(msg) {
+    console.log(msg);
+    var el = document.getElementById("info");
+    el.textContent += msg + '\n';
+}
+
+function doShow() {
+    StatusBar.show();
+    log('StatusBar.isVisible=' + StatusBar.isVisible);
+}
+
+function doHide() {
+    StatusBar.hide();
+    log('StatusBar.isVisible=' + StatusBar.isVisible);
+}
+
+function doColor1() {
+    log('set color=red');
+    StatusBar.backgroundColorByName('red');
+}
+
+function doColor2() {
+    log('set color=default');
+    StatusBar.styleDefault();
+}
+
+var showOverlay = true;
+function doOverlay() {
+    showOverlay = !showOverlay;
+    StatusBar.overlaysWebView(showOverlay);
+    log('Set overlay=' + showOverlay);
+}
+
+/**
+ * Function called when page has finished loading.
+ */
+function init() {
+    document.addEventListener("deviceready", function() {
+        log("Device="+device.platform+" "+device.version);
+        log('StatusBar.isVisible=' + StatusBar.isVisible);
+    }, false);
+}
+
+window.onload = function() {
+  addListenerToClass('action-show', doShow);
+  addListenerToClass('action-hide', doHide);
+  addListenerToClass('action-color1', doColor1);
+  addListenerToClass('action-color2', doColor2);
+  addListenerToClass('action-overlays', doOverlay);
+  addListenerToClass('backBtn', backHome);
+  init();
+  window.addEventListener('statusTap', function() {
+      log('tap!');
+  }, false);
+}