FAQ
Author: lofwyr
Date: Wed Jun 15 07:26:13 2016
New Revision: 1748507

URL: http://svn.apache.org/viewvc?rev=1748507&view=rev
Log:
TOBAGO-1567: Clean up: consolidate getFormattedValue() and other methods.
* QUnit Tests

Added:
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrentValueController.java
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml
     myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/java.xhtml
       - copied, changed from r1747706, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/test.xhtml

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrentValueController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrentValueController.java?rev=1748507&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrentValueController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrentValueController.java Wed Jun 15 07:26:13 2016
@@ -0,0 +1,37 @@
+package org.apache.myfaces.tobago.example.demo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Named;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Named
+public class CurrentValueController {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CurrentValueController.class);
+
+ public Date date;
+
+ public CurrentValueController() {
+ try {
+ this.date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1969-07-24 16:50:35");
+ } catch (ParseException e) {
+ LOG.error("", e);
+ }
+ }
+
+ public String getString() {
+ return "simple string";
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public String toUpperCase(final String text) {
+ return text != null ? text.toUpperCase() : null;
+ }
+}

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js?rev=1748507&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.test.js Wed Jun 15 07:26:13 2016
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("formatted values: out string", function (assert) {
+ var $out = jQueryFrame("#page\\:outString");
+ assert.equal($out.text().trim(), "simple string");
+});
+
+QUnit.test("formatted values: out date", function (assert) {
+ var $out = jQueryFrame("#page\\:outDate");
+ assert.equal($out.text().trim(), "24.07.1969");
+});
+
+// TODO: we may need not trim() below, if we have a labelLayout="skip" freature to skip the sourounging container.
+QUnit.test("formatted values: out method", function (assert) {
+ var $out = jQueryFrame("#page\\:outMethod");
+ assert.equal($out.text().trim(), "HELLO WORLD!");
+});

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml?rev=1748507&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml Wed Jun 15 07:26:13 2016
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * 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.
+-->
+
+<ui:composition template="/main.xhtml"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:param name="title" value="Test: RendererBase.getCurrentValue()"/>
+
+ <tc:out id="outString" labelLayout="none" value="#{currentValueController.string}"/>
+
+ <tc:out id="outDate" labelLayout="none" value="#{currentValueController.date}"/>
+
+ <tc:out id="outMethod" labelLayout="none" value="#{currentValueController.toUpperCase('Hello world!')}"/>
+
+</ui:composition>

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/java.xhtml (from r1747706, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/test.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/java.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/java.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/test.xhtml&r1=1747706&r2=1748507&rev=1748507&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/test.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/50000-java/java.xhtml Wed Jun 15 07:26:13 2016
@@ -23,6 +23,6 @@

    <ui:param name="title" value="TODO"/>

-TODO
+Testing the Java API, more or less directly (if possible).

  </ui:composition>

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categoriesmyfaces
postedJun 15, '16 at 7:26a
activeJun 15, '16 at 7:26a
posts1
users1
websitemyfaces.apache.org

1 user in discussion

Lofwyr: 1 post

People

Translate

site design / logo © 2019 Grokbase