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 2012/07/10 15:27:26 UTC

[1/3] git commit: WICKET-4650 Do not publish '/dom/node/added' is there is no added node

Updated Branches:
  refs/heads/master c8c8f502a -> a36a0833a


WICKET-4650 Do not publish '/dom/node/added' is there is no added node

Add a test case


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

Branch: refs/heads/master
Commit: a36a0833a541822cc75e00c2a94ab9c5262f5d27
Parents: 88fff3f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Jul 10 16:26:51 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jul 10 16:26:51 2012 +0300

----------------------------------------------------------------------
 wicket-core/src/test/js/dom.js |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a36a0833/wicket-core/src/test/js/dom.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/js/dom.js b/wicket-core/src/test/js/dom.js
index a5ea567..be8e20b 100644
--- a/wicket-core/src/test/js/dom.js
+++ b/wicket-core/src/test/js/dom.js
@@ -180,5 +180,28 @@ jQuery(document).ready(function() {
 		var toReplace = Wicket.$('testDomEventNotifications');
 		var newElementMarkup = '<div id="testDomEventNotifications">New One</div>';
 		Wicket.DOM.replace(toReplace, newElementMarkup);
+		jQuery(document).off();
+	});
+
+	/**
+	 * https://issues.apache.org/jira/browse/WICKET-4650
+	 */
+	test("replace - do not publish '/dom/node/added' event notification when removing a component", function() {
+
+		expect(1);
+
+		Wicket.Event.subscribe('/dom/node/removing', function(jqEvent, elementToBeRemoved) {
+			start();
+			equal(elementToBeRemoved.id, "testDomEventNotifications", "The removed element id match!");
+		});
+
+		Wicket.Event.subscribe('/dom/node/added', function(jqEvent, addedElement) {
+			ok(false, "Event '/dom/node/added' should not be published when the new markup of the component is empty text!");
+		});
+
+		var toReplace = Wicket.$('testDomEventNotifications');
+		var newElementMarkup = '';
+		Wicket.DOM.replace(toReplace, newElementMarkup);
+		jQuery(document).off();
 	});
 });