cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject webworks commit: [CB-4887] Added support for true/false for hidekeyboardformaccessorybar
Date Wed, 16 Oct 2013 12:47:08 GMT
Updated Branches:
  refs/heads/master 6f63be2cc -> 3d93c49d6


[CB-4887] Added support for true/false for hidekeyboardformaccessorybar


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

Branch: refs/heads/master
Commit: 3d93c49d608ff708a8dfa63119f3e420fa527eaa
Parents: 6f63be2
Author: Kristoffer Flores <kflores@blackberry.com>
Authored: Tue Oct 8 16:22:48 2013 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Wed Oct 16 08:51:23 2013 -0400

----------------------------------------------------------------------
 .../project/cordova/lib/config-parser.js        | 19 +++++++++--------
 .../test/cordova/unit/spec/lib/config-parser.js | 22 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3d93c49d/blackberry10/bin/templates/project/cordova/lib/config-parser.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/config-parser.js b/blackberry10/bin/templates/project/cordova/lib/config-parser.js
index 881f49b..e887103 100644
--- a/blackberry10/bin/templates/project/cordova/lib/config-parser.js
+++ b/blackberry10/bin/templates/project/cordova/lib/config-parser.js
@@ -539,7 +539,9 @@ function processNameAndDescription(data, widgetConfig) {
 
 function processCordovaPreferences(data, widgetConfig) {
     if (data.preference) {
-        var preference = JSON.parse(JSON.stringify(processParamObj(data.preference)).toLowerCase());
+        var preference = JSON.parse(JSON.stringify(processParamObj(data.preference)).toLowerCase()),
+            hideFormControl = preference.hidekeyboardformaccessorybar;
+
         widgetConfig.packageCordovaJs = preference.packagecordovajs === "enable";
         widgetConfig.autoHideSplashScreen = preference.autohidesplashscreen !== "false";
 
@@ -550,17 +552,17 @@ function processCordovaPreferences(data, widgetConfig) {
 
         // <preference name="childBrowser" value="enable or disable" />
         if (preference.childbrowser) {
-            widgetConfig.enableChildWebView = ((preference.childbrowser + '').toLowerCase()
=== 'disable') === false;
+            widgetConfig.enableChildWebView = (preference.childbrowser === 'disable') ===
false;
         }
 
-        // <preference name="HideKeyboardFormAccessoryBar" value="enable or disable" />
+        // <preference name="HideKeyboardFormAccessoryBar" value="enable/true or disable/false"
/>
         if (preference.hidekeyboardformaccessorybar) {
-            widgetConfig.enableFormControl = ((preference.hidekeyboardformaccessorybar +
'').toLowerCase() === 'enable') === false;
+            widgetConfig.enableFormControl = (hideFormControl !== 'enable' ) && (hideFormControl
!== 'true');
         }
 
         // <preference name="popupBlocker" value="enable or disable" />
         if (preference.popupblocker) {
-            widgetConfig.enablePopupBlocker = ((preference.popupblocker + '').toLowerCase()
=== 'enable') === true;
+            widgetConfig.enablePopupBlocker = (preference.popupblocker === 'enable') ===
true;
         }
 
         // <preference name="orientation" value="portrait, landscape, north, auto or default"
/>
@@ -575,14 +577,13 @@ function processCordovaPreferences(data, widgetConfig) {
 
         // <preference name="theme" value="bright, dark, inherit or default" />
         if (preference.theme && (typeof preference.theme === "string")) {
-            preference.theme = preference.theme.toLowerCase();
             if (preference.theme ===  "bright" || preference.theme === "dark" || preference.theme
=== "inherit" || preference.theme ===  "default") {
                 widgetConfig.theme = preference.theme;
             }
         }
 
         // <preference name="webSecurity" value="enable or disable" />
-        if (preference.websecurity && (typeof preference.websecurity === "string")
&& (preference.websecurity.toLowerCase() === "disable")) {
+        if (preference.websecurity && (typeof preference.websecurity === "string")
&& (preference.websecurity === "disable")) {
             widgetConfig.enableWebSecurity = false;
             logger.warn(localize.translate("WARNING_WEBSECURITY_DISABLED"));
         }
@@ -656,8 +657,8 @@ function init() {
                 logger.warn(localize.translate("WARNING_ORIENTATION_DEPRECATED"));
             }
         }
-    }
-};
+    };
+}
 
 _self = {
     parse: function (xmlPath, session, callback) {

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/3d93c49d/blackberry10/bin/test/cordova/unit/spec/lib/config-parser.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/test/cordova/unit/spec/lib/config-parser.js b/blackberry10/bin/test/cordova/unit/spec/lib/config-parser.js
index 8d9a8a5..7a5e3bc 100644
--- a/blackberry10/bin/test/cordova/unit/spec/lib/config-parser.js
+++ b/blackberry10/bin/test/cordova/unit/spec/lib/config-parser.js
@@ -1298,6 +1298,17 @@ describe("config parser", function () {
                 });
             });
 
+            it("sets enableFormControl to true when HideKeyboardFormAccessoryBar value is
false", function () {
+                var data = testUtilities.cloneObj(testData.xml2jsConfig);
+                data['preference'] = { '@': { name: 'HideKeyboardFormAccessoryBar', value:
'false'  } };
+
+                mockParsing(data);
+
+                configParser.parse(configPath, session, function (configObj) {
+                    expect(configObj.enableFormControl).toBe(true);
+                });
+            });
+
             it("sets enableFormControl to false when value is enable", function () {
                 var data = testUtilities.cloneObj(testData.xml2jsConfig);
                 data['preference'] = { '@': { name: 'HideKeyboardFormAccessoryBar', value:
'enable' } };
@@ -1308,6 +1319,17 @@ describe("config parser", function () {
                     expect(configObj.enableFormControl).toBe(false);
                 });
             });
+
+            it("sets enableFormControl to false when value is true", function () {
+                var data = testUtilities.cloneObj(testData.xml2jsConfig);
+                data['preference'] = { '@': { name: 'HideKeyboardFormAccessoryBar', value:
'true' } };
+
+                mockParsing(data);
+
+                configParser.parse(configPath, session, function (configObj) {
+                    expect(configObj.enableFormControl).toBe(false);
+                });
+            });
         });
 
         describe('setting theme for some core ui elements', function () {


Mime
View raw message