Repository: wicket
Updated Branches:
  refs/heads/master e04d7ee3a -> 75422cc98


WICKET-6085 return evaluated function so that it can be invoked


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/75422cc9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/75422cc9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/75422cc9

Branch: refs/heads/master
Commit: 75422cc984fe2766b0ab2a481c16e032a7904d40
Parents: e04d7ee
Author: Sven Meier <[email protected]>
Authored: Sat Feb 6 22:35:05 2016 +0100
Committer: Sven Meier <[email protected]>
Committed: Sat Feb 6 22:35:05 2016 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js  |  5 ++---
 wicket-core/src/test/js/ajax.js                          | 11 ++---------
 .../test/js/data/ajax/twoEvaluationsWithIdentifier.xml   |  2 +-
 3 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/75422cc9/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 0f8a67f..aff5556 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -1182,12 +1182,11 @@
 
                        var evaluateWithManualNotify = function (parameters, 
body) {
                                return function(notify) {
-                                       var f = jQuery.noop;
-                                       var toExecute = "f = function(" + 
parameters + ") {" + body + "};";
+                                       var toExecute = "(function(" + 
parameters + ") {" + body + "})";
 
                                        try {
                                                // do the evaluation in global 
scope
-                                               window.eval(toExecute);
+                                               var f = window.eval(toExecute);
                                                f(notify);
                                        } catch (exception) {
                                                
log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: 
" + exception + ", text: " + text);

http://git-wip-us.apache.org/repos/asf/wicket/blob/75422cc9/wicket-core/src/test/js/ajax.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/ajax.js b/wicket-core/src/test/js/ajax.js
index d36d6da..c66ef6d 100644
--- a/wicket-core/src/test/js/ajax.js
+++ b/wicket-core/src/test/js/ajax.js
@@ -121,18 +121,11 @@ jQuery(document).ready(function() {
                 */
                asyncTest('processEvaluation*s* with identifier|code.', 
function () {
 
-                       expect(7);
+                       expect(6);
 
                        var attrs = {
                                u: 'data/ajax/twoEvaluationsWithIdentifier.xml',
-                               c: 'twoEvaluationsWithIdentifier',
-                               counter: 0,
-                               coh: [
-                                       function(attrs) {
-                                               start();
-                                               equal(attrs.counter, 3, "The 
counter is incremented in both evaluations with and without manual notifying");
-                                       }
-                               ]
+                               c: 'twoEvaluationsWithIdentifier'
                        };
                        execute(attrs);
                });

http://git-wip-us.apache.org/repos/asf/wicket/blob/75422cc9/wicket-core/src/test/js/data/ajax/twoEvaluationsWithIdentifier.xml
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/data/ajax/twoEvaluationsWithIdentifier.xml 
b/wicket-core/src/test/js/data/ajax/twoEvaluationsWithIdentifier.xml
index 12706d9..92847bb 100644
--- a/wicket-core/src/test/js/data/ajax/twoEvaluationsWithIdentifier.xml
+++ b/wicket-core/src/test/js/data/ajax/twoEvaluationsWithIdentifier.xml
@@ -15,4 +15,4 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<ajax-response><evaluate>(function(){notify|context.attrs.counter++; ok(true, 
'Evaluation1 with identifier must be executed!'); equal(typeof(notify), 
'function', 'The passed identifier1 must be a function'); 
notify();})();(function(){context.attrs.counter++;ok(true, 'Evaluation2 without 
identifier must be 
executed!');})();(function(){notify|context.attrs.counter++;ok(true, 
'Evaluation3 with identifier must be executed!'); equal(typeof(notify), 
'function', 'The passed identifier3 must be a function'); 
notify();})();</evaluate></ajax-response>
\ No newline at end of file
+<ajax-response><evaluate>(function(){notify|ok(true, 'Evaluation1 with 
identifier must be executed!'); equal(typeof(notify), 'function', 'The passed 
identifier1 must be a function'); notify();})();(function(){ok(true, 
'Evaluation2 without identifier must be 
executed!');})();(function(){notify|start();ok(true, 'Evaluation3 with 
identifier must be executed!'); equal(typeof(notify), 'function', 'The passed 
identifier3 must be a function'); notify();})();</evaluate></ajax-response>
\ No newline at end of file

Reply via email to