cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject webworks commit: CB-7462 Change WebInspector dialog to a toast
Date Thu, 04 Sep 2014 14:35:15 GMT
Repository: cordova-blackberry
Updated Branches:
  refs/heads/master 0f8b9add0 -> 4842f7bd6


CB-7462 Change WebInspector dialog to a toast

This will allow code execution to continue while displaying the IP
address and port of WebInspector to the developer.


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/4842f7bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/4842f7bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/4842f7bd

Branch: refs/heads/master
Commit: 4842f7bd646497100ccd27bfce056da52129fd9d
Parents: 0f8b9ad
Author: James Keshavarzi <jkeshavarzi@blackberry.com>
Authored: Wed Aug 20 11:03:14 2014 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Thu Sep 4 10:35:05 2014 -0400

----------------------------------------------------------------------
 framework/lib/framework.js           | 11 +++++------
 framework/test/unit/lib/framework.js | 14 +++++---------
 2 files changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/4842f7bd/framework/lib/framework.js
----------------------------------------------------------------------
diff --git a/framework/lib/framework.js b/framework/lib/framework.js
index a7f7efa..d57f2aa 100644
--- a/framework/lib/framework.js
+++ b/framework/lib/framework.js
@@ -53,7 +53,7 @@ function removeEvents() {
 
 function showWebInspectorInfo() {
     var port = window.qnx.webplatform.getApplication().webInspectorPort,
-        messageObj = {};
+        message = "WebInspector Address\n";
 
     qnx.webplatform.device.getNetworkInterfaces(function (networkInfo) {
         var connectedInterface;
@@ -64,14 +64,13 @@ function showWebInspectorInfo() {
             }
         }, this);
 
-        messageObj.title = "Web Inspector Enabled";
         if (connectedInterface) {
-            messageObj.htmlmessage =  "\n ip4:    " + connectedInterface.ipv4Address + ":"
+ port + "<br/> ip6:    " + connectedInterface.ipv6Address + ":" + port;
+            message +=  connectedInterface.ipv4Address + ":" + port;
         } else {
-            messageObj.message = "Connect to the simulator's IP on port: " + port;
+            message += "Connect to the simulator's IP on port: " + port;
         }
-        messageObj.dialogType = 'JavaScriptAlert';
-        overlayWebView.showDialog(messageObj);
+
+        overlayWebView.showToast(message, {buttonText: "dismiss", timeout: 30000}); // 30
seconds with a dismiss button
     });
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/4842f7bd/framework/test/unit/lib/framework.js
----------------------------------------------------------------------
diff --git a/framework/test/unit/lib/framework.js b/framework/test/unit/lib/framework.js
index c37c2d6..0c21d4a 100644
--- a/framework/test/unit/lib/framework.js
+++ b/framework/test/unit/lib/framework.js
@@ -303,7 +303,7 @@ describe("framework", function () {
     describe('shows the webinspector dialog', function () {
         it('show the webinspector dialog', function () {
             var flag = false;
-            spyOn(overlayWebView, "showDialog");
+            spyOn(overlayWebView, "showToast");
 
             window.qnx.webplatform.device.getNetworkInterfaces = function (callback) {
                 callback();
@@ -315,14 +315,14 @@ describe("framework", function () {
                 return flag;
             });
             runs(function () {
-                expect(overlayWebView.showDialog).toHaveBeenCalled();
+                expect(overlayWebView.showToast).toHaveBeenCalled();
             });
         });
 
         it('show the webinspector dialog with the correct IP address', function () {
             var flag = false,
             messageObj;
-            spyOn(overlayWebView, "showDialog");
+            spyOn(overlayWebView, "showToast");
 
             window.qnx.webplatform.device.getNetworkInterfaces = function (callback) {
                 var dummyData = {
@@ -372,12 +372,8 @@ describe("framework", function () {
                 return flag;
             });
             runs(function () {
-                messageObj = {
-                    title : "Web Inspector Enabled",
-                    htmlmessage : "\n ip4:    169.254.0.1:1337<br/> ip6:    fe80::70aa:b2ff:fef9:b374:1337",
-                    dialogType : "JavaScriptAlert"
-                };
-                expect(overlayWebView.showDialog).toHaveBeenCalledWith(messageObj);
+                message = "WebInspector Address\n169.254.0.1:1337";
+                expect(overlayWebView.showToast).toHaveBeenCalledWith(message, jasmine.any(Object));
             });
         });
 


Mime
View raw message