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/18 10:09:42 UTC
[18/21] git commit: Rework CDI InjectionPage test to use Promise pipes
Rework CDI InjectionPage test to use Promise pipes
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e1e7a7e2
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e1e7a7e2
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e1e7a7e2
Branch: refs/heads/master
Commit: e1e7a7e2eb2804df2346d26120b834d96034740e
Parents: a567813
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Jun 18 09:55:06 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jun 18 09:55:06 2013 +0200
----------------------------------------------------------------------
.../main/webapp/js-test/tests/cdi/injection.js | 32 ++++++++++++--------
1 file changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/e1e7a7e2/wicket-examples/src/main/webapp/js-test/tests/cdi/injection.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/cdi/injection.js b/wicket-examples/src/main/webapp/js-test/tests/cdi/injection.js
index 9e55d7e..fc0f611 100644
--- a/wicket-examples/src/main/webapp/js-test/tests/cdi/injection.js
+++ b/wicket-examples/src/main/webapp/js-test/tests/cdi/injection.js
@@ -18,31 +18,39 @@
$q(document).ready(function() {
"use strict";
+ var countSelector = 'p > span';
+
+ var increment = function($) {
+ return gym.click($('a:contains("increment")'));
+ };
+
module('CDI');
asyncTest('injection', function () {
expect(2);
+ var initialValue;
+
gym.load('/cdi/injection').then(function($) {
- var initialValue = $('p > span').text();
+ initialValue = $(countSelector).text();
initialValue = parseInt(initialValue, 10);
- gym.click($('p > a')).then(function($$) {
+ return increment($);
+ }).then(function($) {
- var counterLabelValue = $$('p > span').text();
- var expectedValue = initialValue + 1;
- equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +1');
+ var counterLabelValue = $(countSelector).text();
+ var expectedValue = initialValue + 1;
+ equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +1');
- gym.click($$('p > a')).then(function($$$) {
+ return increment($);
+ }).then(function($) {
- counterLabelValue = $$$('p > span').text();
- expectedValue = initialValue + 2;
- equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +2');
+ var counterLabelValue = $(countSelector).text();
+ var expectedValue = initialValue + 2;
+ equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +2');
- start();
- });
- });
+ start();
});
});