You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/10/17 01:49:00 UTC

[2/3] spec commit: CB-5104 add test case for device.cordova value

CB-5104 add test case for device.cordova value


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

Branch: refs/heads/master
Commit: 6b2005eec3666fe991de21177d0b808c05f5ec89
Parents: fee17d9
Author: Carlos Santana <cs...@gmail.com>
Authored: Wed Oct 16 15:29:28 2013 -0400
Committer: Carlos Santana <cs...@gmail.com>
Committed: Wed Oct 16 17:12:25 2013 -0400

----------------------------------------------------------------------
 autotest/tests/device.tests.js | 11 ++++++++++-
 index.html                     |  5 +++--
 main.js                        |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/6b2005ee/autotest/tests/device.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/device.tests.js b/autotest/tests/device.tests.js
index 844ed9f..0bcd0d9 100644
--- a/autotest/tests/device.tests.js
+++ b/autotest/tests/device.tests.js
@@ -47,7 +47,16 @@ describe('Device Information (window.device)', function () {
         expect(window.device.cordova).toBeDefined();
 		expect((new String(window.device.cordova)).length > 0).toBe(true);
 	});
-	
+
+    it("should depend on the precense of cordova.version string", function() {
+            expect(window.cordova.version).toBeDefined();
+            expect((new String(window.cordova.version)).length > 0).toBe(true);
+    });
+
+    it("should contain device.cordova equal to cordova.version", function() {
+             expect(window.device.cordova).toBe(window.cordova.version);
+    });
+
 	it("should contain a model specification that is a string", function() {
         expect(window.device.model).toBeDefined();
 		expect((new String(window.device.model)).length > 0).toBe(true);

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/6b2005ee/index.html
----------------------------------------------------------------------
diff --git a/index.html b/index.html
index 568d94f..82f6d3b 100644
--- a/index.html
+++ b/index.html
@@ -34,11 +34,12 @@
   <body onload="init();" 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"> 
+        <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>
@@ -47,7 +48,7 @@
     <a href="audio/index.html" class="btn large">Audio Play/Record</a>
     <a href="battery/index.html" class="btn large">Battery</a>
     <a href="camera/index.html" class="btn large">Camera</a>
-    <a href="capture/index.html" class="btn large">Capture</a>    
+    <a href="capture/index.html" class="btn large">Capture</a>
     <a href="compass/index.html" class="btn large">Compass</a>
     <a href="contacts/index.html" class="btn large">Contacts</a>
     <a href="events/index.html" class="btn large">Events</a>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/6b2005ee/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 5f071c4..9508770 100644
--- a/main.js
+++ b/main.js
@@ -20,6 +20,7 @@
 */
 
 var deviceInfo = function() {
+    document.getElementById("cordova").innerHTML = cordova.version;
     document.getElementById("platform").innerHTML = device.platform;
     document.getElementById("version").innerHTML = device.version;
     document.getElementById("uuid").innerHTML = device.uuid;