Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x 72e61c269 -> 77f30ce4e


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/77f30ce4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/77f30ce4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/77f30ce4

Branch: refs/heads/wicket-6.x
Commit: 77f30ce4eb5daa70da51ddb9bdf1599b159047fe
Parents: 72e61c2
Author: Sven Meier <[email protected]>
Authored: Sat Feb 6 22:35:05 2016 +0100
Committer: Sven Meier <[email protected]>
Committed: Sat Feb 6 22:36:45 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/77f30ce4/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 d0fa7e3..7bde469 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
@@ -1199,12 +1199,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/77f30ce4/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 2d237fd..7cfb2f1 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/77f30ce4/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