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/06/19 16:04:22 UTC

git commit: Re-work the JS tests to Promise pipes

Updated Branches:
  refs/heads/master cd3c7c8c5 -> 3254bfc0d


Re-work the JS tests to Promise pipes

It is easier to follow the flow this way


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

Branch: refs/heads/master
Commit: 3254bfc0da5e17b821e383e6bd3c97198fbdb3f6
Parents: cd3c7c8
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 19 16:03:38 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 19 16:03:38 2013 +0200

----------------------------------------------------------------------
 .../src/main/webapp/js-test/tests/ajax/form.js  | 33 ++++++++++----------
 .../src/main/webapp/js-test/tests/echo.js       | 16 +++++-----
 .../src/main/webapp/js-test/tests/forminput.js  | 32 +++++++++----------
 .../src/main/webapp/js-test/tests/helloworld.js |  3 +-
 4 files changed, 41 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3254bfc0/wicket-examples/src/main/webapp/js-test/tests/ajax/form.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/ajax/form.js b/wicket-examples/src/main/webapp/js-test/tests/ajax/form.js
index af7b266..eb348b1 100644
--- a/wicket-examples/src/main/webapp/js-test/tests/ajax/form.js
+++ b/wicket-examples/src/main/webapp/js-test/tests/ajax/form.js
@@ -30,28 +30,27 @@ $q(document).ready(function() {
 			var name = 'Ajax form name';
 			$nameInput.val(name);
 
-			gym.ajaxClick($('input[name=ajax-button]')).then(function($$) {
+			return gym.ajaxClick($('input[name=ajax-button]'));
+		}).then(function($) {
 
-				// an error feedback message that email is mandatory is expected
-				var $feedback = $$('li.feedbackPanelERROR > span');
-				equal($feedback.length, 1, 'The error feedback message that email is missing is here');
-				equal($feedback.text(), 'Email is required', 'The error feedback matches');
+			// an error feedback message that email is mandatory is expected
+			var $feedback = $('li.feedbackPanelERROR > span');
+			equal($feedback.length, 1, 'The error feedback message that email is missing is here');
+			equal($feedback.text(), 'Email is required', 'The error feedback matches');
 
-				// enter the email field too
-				var $emailInput = $$('input[name=email]');
-				var email = 'contact@example.com';
-				$emailInput.val(email);
+			// enter the email field too
+			var $emailInput = $('input[name=email]');
+			var email = 'contact@example.com';
+			$emailInput.val(email);
 
-				gym.ajaxClick($$('input[name=ajax-button]')).then(function($$$) {
+			return gym.ajaxClick($('input[name=ajax-button]'));
+		}).then(function($) {
 
-					// the feedback panel must be empty now
-					var $feedback = $$$('li.feedbackPanelERROR > span');
-					equal($feedback.length, 0, 'The error feedback message should be gone');
+			// the feedback panel must be empty now
+			var $feedback = $('li.feedbackPanelERROR > span');
+			equal($feedback.length, 0, 'The error feedback message should be gone');
 
-					start();
-				});
-			});
-		});
+		}).always(start);
 	});
 
 });

http://git-wip-us.apache.org/repos/asf/wicket/blob/3254bfc0/wicket-examples/src/main/webapp/js-test/tests/echo.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/echo.js b/wicket-examples/src/main/webapp/js-test/tests/echo.js
index 8635629..2264f55 100644
--- a/wicket-examples/src/main/webapp/js-test/tests/echo.js
+++ b/wicket-examples/src/main/webapp/js-test/tests/echo.js
@@ -23,21 +23,21 @@ $q(document).ready(function() {
 	asyncTest('echo', function () {
 		expect(2);
 
+		var message = 'Hello Functional QUnit';
+
 		gym.load('/echo').then(function($) {
 
 			var $messageInput = $('input[name=msgInput]');
-			var message = 'Hello Functional QUnit';
 			$messageInput.val(message);
 
-			gym.click($('input[type=submit]')).then(function($$) {
+			return gym.click($('input[type=submit]'));
+		}).then(function($) {
 
-				var $msg = $$('#msg');
-				equal($msg.length, 1, 'The entered message is here');
-				equal($msg.text(), message, 'The entered message is here');
+			var $msg = $('#msg');
+			equal($msg.length, 1, 'The entered message is here');
+			equal($msg.text(), message, 'The entered message is here');
 
-				start();
-			});
-		});
+		}).always(start);
 	});
 
 });

http://git-wip-us.apache.org/repos/asf/wicket/blob/3254bfc0/wicket-examples/src/main/webapp/js-test/tests/forminput.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/forminput.js b/wicket-examples/src/main/webapp/js-test/tests/forminput.js
index 9c45c06..df27b7b 100644
--- a/wicket-examples/src/main/webapp/js-test/tests/forminput.js
+++ b/wicket-examples/src/main/webapp/js-test/tests/forminput.js
@@ -23,21 +23,22 @@ $q(document).ready(function() {
 	asyncTest('Change StringProperty', function () {
 		expect(2);
 
+		var text = 'qunit test value';
+
 		gym.load('/forminput').then(function($) {
 
 			var $stringPropertyInput = $('#stringProperty');
-			var text = 'qunit test value';
+
 			$stringPropertyInput.val(text);
 
-			gym.click($('input[value=save]')).then(function($$) {
+			return gym.click($('input[value=save]'));
+		}).then(function($) {
+
+			var $feedback = $('li.feedbackPanelINFO > span');
+			equal($feedback.length, 1, 'The feedback is here');
+			equal($feedback.text().indexOf("stringProperty = '"+text+"'"), 29, 'The entered text is here');
 
-				var $feedback = $$('li.feedbackPanelINFO > span');
-				equal($feedback.length, 1, 'The feedback is here');
-				equal($feedback.text().indexOf("stringProperty = '"+text+"'"), 29, 'The entered text is here');
-				
-				start();
-			});
-		});
+		}).always(start);
 	});
 
 	asyncTest('Change the locale', function () {
@@ -50,15 +51,14 @@ $q(document).ready(function() {
 
 			$select.val(locale);
 
-			gym.click($('input[value=save]')).then(function($$) {
+			return gym.click($('input[value=save]'));
+		}).then(function($) {
 
-				var $integerInRangeProperty = $$('label[for=integerInRangeProperty]');
-				equal($integerInRangeProperty.length, 1, 'The label for integerInRangeProperty is here');
-				equal($integerInRangeProperty.text(), 'Nur Werte zwischen 0 und 100 sind erlaubt', 'The german version is correct');
+			var $integerInRangeProperty = $('label[for=integerInRangeProperty]');
+			equal($integerInRangeProperty.length, 1, 'The label for integerInRangeProperty is here');
+			equal($integerInRangeProperty.text(), 'Nur Werte zwischen 0 und 100 sind erlaubt', 'The german version is correct');
 
-				start();
-			});
-		});
+		}).always(start);
 	});
 
 });

http://git-wip-us.apache.org/repos/asf/wicket/blob/3254bfc0/wicket-examples/src/main/webapp/js-test/tests/helloworld.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/helloworld.js b/wicket-examples/src/main/webapp/js-test/tests/helloworld.js
index 573c85a..56c5933 100644
--- a/wicket-examples/src/main/webapp/js-test/tests/helloworld.js
+++ b/wicket-examples/src/main/webapp/js-test/tests/helloworld.js
@@ -29,8 +29,7 @@ $q(document).ready(function() {
 			equal($message.length, 1, "The greeting is there");
 			equal($message.text(), 'Hello World!', "The greeting is correct");
 
-			start();
-		});
+		}).always(start);
 	});
 
 });