You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2013/05/01 21:45:40 UTC

js commit: [CB-3310] add default textbox for notification prompt

Updated Branches:
  refs/heads/master d4876eb28 -> 9fcf6d89e


[CB-3310] add default textbox for notification prompt

- added defaultText parameter to notification prompt
- updated prompt testcases


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

Branch: refs/heads/master
Commit: 9fcf6d89ef55b21c57a8541c61808cbeb4d8f6e5
Parents: d4876eb
Author: James Jong <wj...@gmail.com>
Authored: Wed May 1 15:43:34 2013 -0400
Committer: James Jong <wj...@gmail.com>
Committed: Wed May 1 15:43:34 2013 -0400

----------------------------------------------------------------------
 lib/common/plugin/notification.js |    6 ++++--
 test/test.notification.js         |    6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/9fcf6d89/lib/common/plugin/notification.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/notification.js b/lib/common/plugin/notification.js
index 676c3ba..47a1c52 100644
--- a/lib/common/plugin/notification.js
+++ b/lib/common/plugin/notification.js
@@ -87,12 +87,14 @@ module.exports = {
      * @param {Function} resultCallback     The callback that is called when user clicks on a button.
      * @param {String} title                Title of the dialog (default: "Prompt")
      * @param {Array} buttonLabels          Array of strings for the button labels (default: ["OK","Cancel"])
+     * @param {String} defaultText          Textbox input value (default: "Default text")
      */
-    prompt: function(message, resultCallback, title, buttonLabels) {
+    prompt: function(message, resultCallback, title, buttonLabels, defaultText) {
         var _message = (message || "Prompt message");
         var _title = (title || "Prompt");
         var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
-        exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels]);
+        var _defaultText = (defaultText || "Default text");
+        exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
     },
 
     /**

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/9fcf6d89/test/test.notification.js
----------------------------------------------------------------------
diff --git a/test/test.notification.js b/test/test.notification.js
index a7122c9..dbe305f 100644
--- a/test/test.notification.js
+++ b/test/test.notification.js
@@ -62,15 +62,15 @@ describe("notification", function () {
             notification.prompt();
             expect(exec).toHaveBeenCalledWith(
                 undefined, null, "Notification", "prompt",
-                ["Prompt message", "Prompt", ['OK','Cancel']]);
+                ["Prompt message", "Prompt", ['OK','Cancel'], "Default text"]);
         });
 
         it("passes the provided params to the exec method", function () {
             var cb = jasmine.createSpy();
-            notification.prompt("baby prompt me one more time!", cb, "oh baby baby", ["Yes", "No"]);
+            notification.prompt("baby prompt me one more time!", cb, "oh baby baby", ["Yes", "No"], "prompt text input");
             expect(exec).toHaveBeenCalledWith(
                 cb, null, "Notification", "prompt", 
-                ["baby prompt me one more time!", "oh baby baby", ['Yes','No']]);
+                ["baby prompt me one more time!", "oh baby baby", ['Yes','No'], "prompt text input"]);
         });
     });