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 2014/02/17 15:59:23 UTC
git commit: Add Gym tests for Mail Template
Repository: wicket
Updated Branches:
refs/heads/master 5bc5ef21f -> af2353943
Add Gym tests for Mail Template
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/af235394
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/af235394
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/af235394
Branch: refs/heads/master
Commit: af23539431d56e781f77f8fecbcfa987d37e4082
Parents: 5bc5ef2
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Feb 17 16:58:34 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Feb 17 16:58:34 2014 +0200
----------------------------------------------------------------------
Gruntfile.js | 4 +
.../wicket/examples/asemail/MailTemplate.html | 4 +-
.../src/main/webapp/js-test/all.html | 2 +
.../main/webapp/js-test/tests/mailtemplate.js | 85 ++++++++++++++++++++
4 files changed, 93 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/af235394/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 642bf12..0459f6c 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -52,6 +52,9 @@ module.exports = function(grunt) {
"./wicket-core/src/test/js/event.js",
"./wicket-core/src/test/js/amd.js"
],
+ gymTestsJs = [
+ "wicket-examples/src/main/webapp/js-test/tests/mailtemplate.js"
+ ],
gruntJs = [
"Gruntfile.js"
];
@@ -67,6 +70,7 @@ module.exports = function(grunt) {
nativeWebSocket: nativeWebSocketJs,
atmosphere: atmosphereJs,
testsJs: testsJs,
+ gymTestsJs: gymTestsJs,
grunt: gruntJs,
options: {
http://git-wip-us.apache.org/repos/asf/wicket/blob/af235394/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.html b/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.html
index 16f2914..75761c6 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/asemail/MailTemplate.html
@@ -21,9 +21,9 @@
<br/><br/>
<h3>Here is the generated markup:</h3>
- <div wicket:id="result">
+ <div wicket:id="result" id="result">
</div>
</body>
-</html>
\ No newline at end of file
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/af235394/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 9226a00..0a23a16 100644
--- a/wicket-examples/src/main/webapp/js-test/all.html
+++ b/wicket-examples/src/main/webapp/js-test/all.html
@@ -30,6 +30,8 @@
<script type="text/javascript" src="tests/bean-validation/email.js"></script>
<script type="text/javascript" src="tests/bean-validation/phone.js"></script>
<script type="text/javascript" src="tests/bean-validation/birthdate.js"></script>
+
+ <script type="text/javascript" src="tests/mailtemplate.js"></script>
</head>
<body>
http://git-wip-us.apache.org/repos/asf/wicket/blob/af235394/wicket-examples/src/main/webapp/js-test/tests/mailtemplate.js
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/js-test/tests/mailtemplate.js b/wicket-examples/src/main/webapp/js-test/tests/mailtemplate.js
new file mode 100644
index 0000000..ac9318c
--- /dev/null
+++ b/wicket-examples/src/main/webapp/js-test/tests/mailtemplate.js
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+/*global module: true, ok: true, asyncTest: true, equal: true, expect: true, $q: true,
+ gym: true, start: true */
+
+$q(document).ready(function() {
+ "use strict";
+
+ module('Mail Template');
+
+ var text = "Gym.js";
+
+ var generate = function($, linkIndex) {
+
+ var $nameInput = $('input[name=name]');
+
+ $nameInput.val(text);
+
+ return gym.ajaxClick($('a:contains("generate")').eq(linkIndex));
+ };
+
+
+ asyncTest('Page', function () {
+ expect(3);
+
+ gym.load('/mailtemplate').then(function($) {
+ return generate($, 0);
+ }).then(function($) {
+
+ var $resultText = $('#result').text();
+ ok($resultText, 'The page is rendered');
+ ok($resultText.indexOf("<!DOCTYPE html>") > -1, 'The HTML5 doctype is here');
+ ok($resultText.indexOf("Hello, <span wicket:id=\"name\">"+text+"</span>") > -1,
+ 'The entered text is here');
+
+ }).always(start);
+ });
+
+
+ asyncTest('Panel', function () {
+ expect(3);
+
+ gym.load('/mailtemplate').then(function($) {
+ return generate($, 1);
+ }).then(function($) {
+
+ var $resultText = $('#result').text();
+ ok($resultText, 'The panel is rendered');
+ ok($resultText.indexOf("<wicket:panel>") > -1, 'The panel markup is here');
+ ok($resultText.indexOf("Hello, <span wicket:id=\"name\">"+text+"</span>") > -1,
+ 'The entered text is here');
+
+ }).always(start);
+ });
+
+ asyncTest('Text Template', function () {
+ expect(2);
+
+ gym.load('/mailtemplate').then(function($) {
+ return generate($, 2);
+ }).then(function($) {
+
+ var $resultText = $('#result').text();
+ ok($resultText, 'The text template is rendered');
+ ok($resultText.indexOf("Hello "+text) > -1, 'The entered text is here');
+
+ }).always(start);
+ });
+
+});