You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/12/05 19:27:01 UTC
[4/5] git commit: Add a basic test for the LocalDate component
Add a basic test for the LocalDate component
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/61990a79
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/61990a79
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/61990a79
Branch: refs/heads/master
Commit: 61990a792998f9cdbb5b6a32dc57037e511838a1
Parents: 1bc4e04
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu Dec 5 10:12:30 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu Dec 5 10:12:30 2013 -0800
----------------------------------------------------------------------
.../tapestry5/integration/app1/MiscTests.groovy | 14 ++++++++++++++
.../integration/app1/pages/LocalDateDemo.groovy | 3 +++
.../tapestry5/integration/app1/pages/Index.java | 2 +-
3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/61990a79/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
index d7d8be6..2db2c52 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
@@ -49,4 +49,18 @@ class MiscTests extends App1TestCase {
assertTextPresent "Unable to locate asset 'does-not-exist.txt' for component MissingAssetDemo. It should be located at META-INF/assets/does-not-exist.txt."
}
+ @Test
+ void local_date_formatting() {
+ openLinks "LocalDate Demo"
+
+ def defaultFormat = getText "local-date-default"
+ def customFormat = getText "local-date-formatted"
+
+ // Because there are so many variables: the date formatted, the locale and time zone of the
+ // server running the tests, etc., all we can really test for is that the
+ // client-side code successfully kicked in and formatted these differently.
+
+ assertNotEquals defaultFormat, customFormat
+ }
+
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/61990a79/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/LocalDateDemo.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/LocalDateDemo.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/LocalDateDemo.groovy
index 175f098..1959caf 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/LocalDateDemo.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/pages/LocalDateDemo.groovy
@@ -1,7 +1,10 @@
package org.apache.tapestry5.integration.app1.pages
+import org.apache.tapestry5.annotations.Cached
+
class LocalDateDemo {
+ @Cached
Date getNow() {
new Date()
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/61990a79/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index c0ad97c..388c5c6 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -58,7 +58,7 @@ public class Index
private static final List<Item> ITEMS = CollectionFactory
.newList(
- new Item("LocalDateDemo", "Local Date Demo", "LocalDate component, based on moment.js"),
+ new Item("LocalDateDemo", "LocalDate Demo", "LocalDate component, based on Moment.js"),
new Item("EmptyIfDemo", "Empty If Demo", "Ensure an empty If can still render."),