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/17 17:04:04 UTC
git commit: Add test for CDI ConversationPage(s)
Updated Branches:
refs/heads/wicket-examples-gym-tests 1789003da -> 82c922c12
Add test for CDI ConversationPage(s)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/82c922c1
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/82c922c1
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/82c922c1
Branch: refs/heads/wicket-examples-gym-tests
Commit: 82c922c122ea44f9be1bd8e2817dbb9c0bc47857
Parents: 1789003
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jun 17 17:03:08 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jun 17 17:03:08 2013 +0200
----------------------------------------------------------------------
.../src/main/webapp/js-test/all.html | 1 +
.../webapp/js-test/tests/cdi/conversation.js | 72 ++++++++++++++++++++
2 files changed, 73 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/82c922c1/wicket-examples/src/main/webapp/js-test/all.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/all.html b/wicket-examples/src/main/webapp/js-test/all.html
index a4b9b74..7f8529f 100644
--- a/wicket-examples/src/main/webapp/js-test/all.html
+++ b/wicket-examples/src/main/webapp/js-test/all.html
@@ -25,6 +25,7 @@
<script type="text/javascript" src="tests/ajax/form.js"></script>
<script type="text/javascript" src="tests/cdi/injection.js"></script>
+ <script type="text/javascript" src="tests/cdi/conversation.js"></script>
</head>
<body>
http://git-wip-us.apache.org/repos/asf/wicket/blob/82c922c1/wicket-examples/src/main/webapp/js-test/tests/cdi/conversation.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/cdi/conversation.js b/wicket-examples/src/main/webapp/js-test/tests/cdi/conversation.js
new file mode 100644
index 0000000..36a4b99
--- /dev/null
+++ b/wicket-examples/src/main/webapp/js-test/tests/cdi/conversation.js
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+$q(document).ready(function() {
+ "use strict";
+
+ var countSelector = 'p > span';
+
+ var increment = function($) {
+ return gym.click($('a:contains("increment")'));
+ };
+
+ var nextPage = function($) {
+ return gym.click($('a:contains("Continue")'));
+ };
+
+ module('CDI');
+
+ asyncTest('conversation', function () {
+ expect(4);
+
+ gym.load('/cdi/conversation').then(function($) {
+
+ var initialValue = $(countSelector).text();
+ initialValue = parseInt(initialValue, 10);
+
+ increment($).then(function($$) {
+
+ var counterLabelValue = $$(countSelector).text();
+ var expectedValue = initialValue + 1;
+ equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +1');
+
+ nextPage($$).then(function($$$) {
+
+ counterLabelValue = $$$(countSelector).text();
+ expectedValue = initialValue + 1;
+ equal(counterLabelValue, "" + expectedValue, 'The value of the counter is the same as in the previous page');
+
+ increment($$$).then(function($$$$) {
+
+ var counterLabelValue = $$$$(countSelector).text();
+ var expectedValue = initialValue + 2;
+ equal(counterLabelValue, "" + expectedValue, 'The new value of the counter is +2');
+
+ nextPage($$$$).then(function($$$$$) {
+
+ counterLabelValue = $$$$$(countSelector).text();
+ equal(counterLabelValue, "0", 'The value of the counter is 0 (no conversation)');
+
+ start();
+ });
+ });
+ });
+ });
+ });
+ });
+
+});
\ No newline at end of file