You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by gt...@apache.org on 2012/11/13 20:13:42 UTC

[2/16] js commit: fix issues with running blackberry tests in the browser runner

fix issues with running blackberry tests in the browser runner


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/46f72160
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/46f72160
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/46f72160

Branch: refs/heads/master
Commit: 46f72160a53f6eb93e2838b930606b7eade77b9d
Parents: ad3b1c9
Author: Gord Tanner <gt...@gmail.com>
Authored: Tue Nov 13 10:43:10 2012 -0500
Committer: Gord Tanner <gt...@gmail.com>
Committed: Tue Nov 13 10:43:10 2012 -0500

----------------------------------------------------------------------
 test/blackberry/test.platform.js |   12 +++++++++---
 test/suite.html                  |    2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/46f72160/test/blackberry/test.platform.js
----------------------------------------------------------------------
diff --git a/test/blackberry/test.platform.js b/test/blackberry/test.platform.js
index ff8da83..e379596 100644
--- a/test/blackberry/test.platform.js
+++ b/test/blackberry/test.platform.js
@@ -24,17 +24,23 @@ describe("blackberry platform", function () {
 
     describe("when getting the runtime", function () {
         it("returns qnx for the bb10 user agent", function () {
-            navigator.userAgent = "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+";
+            navigator.__defineGetter__("userAgent", function () {
+               return "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+";
+            });
             expect(platform.runtime()).toBe("qnx");
         });
 
         it("returns air for the playbook user agent", function () {
-            navigator.userAgent = "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+";
+            navigator.__defineGetter__("userAgent", function () {
+               return "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+";
+            });
             expect(platform.runtime()).toBe("air");
         });
 
         it("returns java for a blackberry user agent", function () {
-            navigator.userAgent = "Mozilla/5.0 (BlackBerry; U; BlackBerry 9100; en) AppleWebKit/534.3+ (KHTML, like Gecko) Version/6.0.0.286 Mobile Safari/534.3+";
+            navigator.__defineGetter__("userAgent", function () {
+               return "Mozilla/5.0 (BlackBerry; U; BlackBerry 9100; en) AppleWebKit/534.3+ (KHTML, like Gecko) Version/6.0.0.286 Mobile Safari/534.3+";
+            });
             expect(platform.runtime()).toBe("java");
         });
     });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/46f72160/test/suite.html
----------------------------------------------------------------------
diff --git a/test/suite.html b/test/suite.html
index 7a10689..c7a9150 100644
--- a/test/suite.html
+++ b/test/suite.html
@@ -43,6 +43,8 @@
         return trivialReporter.specFilter(spec);
       };
 
+      window.global = window;
+
       window.cordova = {
          platform: ""
       };