You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/03/27 08:43:35 UTC

[2/2] git commit: WICKET-5117 Wicket ignores allowDefault:false attribute in multipart ajax requests

WICKET-5117 Wicket ignores allowDefault:false attribute in multipart ajax requests

Add unit tests


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

Branch: refs/heads/master
Commit: 3cc807b43d77c33d5d5c24e381e7336f7ed4c822
Parents: 7223042
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Mar 27 09:43:01 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Mar 27 09:43:01 2013 +0200

----------------------------------------------------------------------
 wicket-core/src/test/js/ajax.js |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3cc807b4/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 fac63a4..2086d73 100644
--- a/wicket-core/src/test/js/ajax.js
+++ b/wicket-core/src/test/js/ajax.js
@@ -968,7 +968,7 @@ jQuery(document).ready(function() {
 		 */
 		asyncTest('Submit nested form - success scenario.', function () {
 
-			expect(7);
+			expect(8);
 
 			var attrs = {
 				f:  "innerForm", // the id of the form to submit
@@ -977,13 +977,19 @@ jQuery(document).ready(function() {
 				e:  "nestedFormSubmit", // the event
 				c:  "innerSubmitButton", // the component that submits the form
 				m:  "POST", // submit method,
+				ad: true, // do not allow default behavior
 				bh: [ function(attrs) { ok(true, "Before handler executed"); } ],
 				pre: [ function(attrs) {ok(true, "Precondition executed"); return true; } ],
 				bsh: [ function(attrs) { ok(true, "BeforeSend handler executed"); } ],
 				ah: [ function(attrs) { ok(true, "After handler executed"); } ],
 				sh: [ function(attrs) { ok(true, "Success handler executed"); } ],
 				fh: [ function(attrs) { ok(false, "Failure handler should not be executed"); } ],
-				coh: [ function(attrs) { ok(true, "Complete handler executed"); } ]
+				coh: [
+					function(attrs) {
+						ok(true, "Complete handler executed");
+						equal(attrs.event.isDefaultPrevented(), false, "default behavior is allowed");
+					}
+				]
 			};
 
 			Wicket.Ajax.ajax(attrs);
@@ -998,7 +1004,7 @@ jQuery(document).ready(function() {
 		 */
 		asyncTest('Submit nested form - failure scenario.', function () {
 
-			expect(6);
+			expect(7);
 
 			var attrs = {
 				f:  "innerForm", // the id of the form to submit
@@ -1007,13 +1013,19 @@ jQuery(document).ready(function() {
 				e:  "nestedFormSubmit", // the event
 				c:  "innerSubmitButton", // the component that submits the form
 				m:  "POST", // submit method,
+				ad: false,
 				bh: [ function(attrs) { ok(true, "Before handler executed"); } ],
 				pre: [ function(attrs) {ok(true, "Precondition executed"); return true; } ],
 				bsh: [ function(attrs) { ok(true, "BeforeSend handler executed"); } ],
 				ah: [ function(attrs) { ok(true, "After handler executed"); } ],
 				sh: [ function(attrs) { ok(false, "Success handler should not be executed"); } ],
 				fh: [ function(attrs) { ok(true, "Failure handler executed"); start(); } ],
-				coh: [ function(attrs) { ok(true, "Complete handler executed"); } ]
+				coh: [
+					function(attrs) {
+						ok(true, "Complete handler executed");
+						equal(attrs.event.isDefaultPrevented(), true, "default behavior is prevented");
+					}
+				]
 			};
 
 			Wicket.Ajax.ajax(attrs);